Valmiki Ramayana Ayodhya Kanda Sarga 1 Shloka 25
Original Shlokaशास्त्रज्ञश्च कृतज्ञश्च पुरुषान्तरकोविदः। यः प्रग्रहानुग्रहयोर्यथान्यायं विचक्षणः।।2.1.25।।
1 source checked for this shloka
यः who (he), शास्त्रज्ञः च wellversed in scriptures, कृतज्ञः च was grateful, पुरुषान्तरकोविद: skilled in differentiating the comparative merits of men, यथान्यायम् in accordance with justice, प्रग्रहानुग्रहयोः in reprimanding and favouring, विचक्षणः was a skilled one.
He was versed in scriptures. He was grateful (to those who did him some good) and skilled in differentiating the comparative merits of men. Fair in his judgement he dispensed justice in accordance with law by reprimanding (the delinquent) and favouring (the honest).