Valmiki Ramayana Ayodhya Kanda Sarga 26 Shloka 36
Original Shlokaऔरसानपि पुत्रान्हि त्यजन्त्यहितकारिणः। समर्थान्सम्प्रगृह्णन्ति जनानपि नराधिपाः।।2.26.36।।
1 source checked for this shloka
नराधिपाः kings, अहितकारिणः harmful men, औरसान् पुत्रानपि even their own sons, त्यजन्ति will abandon, समर्थान् capable men, जनानपि even other people, सम्प्रगृह्णन्ति accept.
Kings abandon (even) their own sons if they are harmful and receive capable people even if they are strangers.