Reference: Declared hasan by Shaykh al-Albaanee in Silsilah al-Ahaadeeth as-Saheehah by virtue of all its different chains of narration.
On the authority of Ibn ‘Umar (radhi-yAllaahu ‘anhumaa) who said:
I was with the Messenger of Allaah ﷺ when a man from the Ansaar came up to the Messenger of Allaah ﷺ and greeted him with the salaam and then said: O Messenger of Allaah ﷺ which of the believers are the best?
Those who are best in character.
Then he asked: Which of the believers are the most intelligent?
Those who remember death the most, and those who are best prepared for what comes after it. These are the intelligent ones.