Valmiki Ramayana Ayodhya Kanda Sarga 105 Shloka 21
Original Shlokaआत्मानमनुशोच त्वं किमन्यमनुशोचसि। आयुस्ते हीयते यस्य स्थितस्य च गतस्य च।।2.105.21।।
1 source checked for this shloka
स्थितस्य च whether you stand, गतस्य च or moving, यस्य whosoever, आयुः life span, हीयते decreases, आत्मानम् about you, त्वम् you, अनुशोच grieve, अन्यम् about others, किम् why, अनुशोचसि are you grieving?
Whether you are static or moving, your lifespan decreases. Therefore, you should only grieve about yourself and not for any one else.