TABARANI 10542:
from Ibn Masʿūd —
[Machine] The Messenger of Allah ﷺ said, "Verily, a person is born a believer and lives as a believer, but then dies as a disbeliever. And verily, a person is born a disbeliever, lives as a disbeliever, but then dies as a believer. And verily, a person may act happily for a period of time in his life, but then what was written for him catches up with him, and he dies unhappy. And verily, a person may act unhappily for a period of time in his life, but then what was written for him catches up with him, and he dies happy."
الطبراني ١٠٥٤٢:
عن ابن مسعود —
قَالَ رَسُولُ اللهِ ﷺ «إِنَّ الْعَبْدَ لَيُولَدُ مُؤْمِنًا وَيَعِيشُ مُؤْمِنًا وَيَمُوتُ كَافِرًا وَإِنَّ الْعَبْدَ لَيُولَدُ كَافِرًا وَيَعِيشُ كَافِرًا وَيَمُوتُ مُؤْمِنًا وَإِنَّ الْعَبْدَ لَيَعْمَلُ بُرْهَةً مِنْ دَهْرِهِ بِالسَّعَادَةِ ثُمَّ يُدْرِكُهُ مَا كُتِبَ لَهُ فَيَمُوتُ شَقِيًّا وَإِنَّ الْعَبْدَ لَيَعْمَلُ بُرْهَةً مِنْ دَهْرِهِ بِالشَّقَاءِ ثُمَّ يُدْرِكُهُ مَا كُتِبَ لَهُ فَيَمُوتُ سَعِيدًا»
hadithunlocked.com