Reference : Hisn al-Muslim 194

الْحَمْـدُ للهِ الّذي عافاني مِمّا ابْتَـلاكَ بِهِ،
وَفَضَّلَـني عَلى كَثيـرٍ مِمَّنْ خَلَـقَ تَفْضـيلا
Alhamdu lillāhi ‘l-ladhī `āfānī mimmab-talāka bihi 
wa faḍḍalanī `alā kathīrin mimman khalaqa tafḍīlā.


Praise is to Allah Who has spared me what He has afflicted you with, 
and preferred me greatly above much of what He has created.

Reference:
At-Tirmidhi 5/493,4. See also Al-Albani, Sahih At-Tirmidhi 3/153.

Chapter: Upon seeing someone in trial or tribulation