Valmiki Ramayana Kishkindha Kanda Sarga 18 Shloka 63
Original Shlokaदण्ड्ये यः पातयेद्दण्डं दण्ड्यो यश्चापि दण्ड्यते। कार्यकारणसिद्धार्था वुभौ तौ नावसीदतः4.18.63।।
1 source checked for this shloka
यः whoever, दण्ड्ये deserves to be punished, दण्डम् punishment, पातयेत् inflicts, यश्चापि and whosoever, दण्ड्यः sinner, दण्ड्यते punished, कार्यकारणसिद्धार्थौ with regard to cause and effect, तौ they, उभौ both, नावसीदतः do not become despondent.
'The sinner and the punisher, whoever gives punishment and whoever receives it, are both regulated by the law of cause and effect. So do not despair.