Valmiki Ramayana Kishkindha Kanda Sarga 7 Shloka 9
Original Shlokaव्यसने वाऽर्थकृच्छ्रे वा भये वा जीवितान्तके। विमृशन्वै स्वया बुद्ध्या धृतिमान्नावसीदति4.7.9।।
1 source checked for this shloka
व्यसने वा in grief or, अर्थकृच्छ्रे वा or even over loss of wealth, जीवितान्तके at the hour of death, भये वा or in fear?, धृतिमान् one who is patient, स्वया बुद्ध्या by his own wisdom, विमृशन् leaving, नावसीदति will not despair
'In times of grief or loss of wealth or at the hour of death, one who is patient does not abandon his wisdom, he does not despair.