Language:
كتاب العلم
3  
Knowledge
(8)
Chapter: Whoever sat at the farther end of a gathering. And whoever found a place amongst a gathering and took his seat there
(8)
باب مَنْ قَعَدَ حَيْثُ يَنْتَهِي بِهِ الْمَجْلِسُ وَمَنْ رَأَى فُرْجَةً فِي الْحَلْقَةِ فَجَلَسَ فِيهَا‏.‏
Sahih al-Bukhari 66

Narrated Abu Waqid Al-Laithi:

While Allah's Messenger (ﷺ) was sitting in the mosque with some people, three men came. Two of them came in front of Allah's Messenger (ﷺ) and the third one went away. The two persons kept on standing before Allah's Messenger (ﷺ) for a while and then one of them found a place in the circle and sat there while the other sat behind the gathering, and the third one went away. When Allah's Messenger (ﷺ) finished his preaching, he said, "Shall I tell you about these three persons? One of them betook himself to Allah, so Allah took him into His grace and mercy and accommodated him, the second felt shy from Allah, so Allah sheltered Him in His mercy (and did not punish him), while the third turned his face from Allah and went away, so Allah turned His face from him likewise. "

حَدَّثَنَا إِسْمَاعِيلُ، قَالَ حَدَّثَنِي مَالِكٌ، عَنْ إِسْحَاقَ بْنِ عَبْدِ اللَّهِ بْنِ أَبِي طَلْحَةَ، أَنَّ أَبَا مُرَّةَ، مَوْلَى عَقِيلِ بْنِ أَبِي طَالِبٍ أَخْبَرَهُ عَنْ أَبِي وَاقِدٍ اللَّيْثِيِّ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم بَيْنَمَا هُوَ جَالِسٌ فِي الْمَسْجِدِ وَالنَّاسُ مَعَهُ، إِذْ أَقْبَلَ ثَلاَثَةُ نَفَرٍ، فَأَقْبَلَ اثْنَانِ إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم وَذَهَبَ وَاحِدٌ، قَالَ فَوَقَفَا عَلَى رَسُولِ اللَّهِ صلى الله عليه وسلم فَأَمَّا أَحَدُهُمَا فَرَأَى فُرْجَةً فِي الْحَلْقَةِ فَجَلَسَ فِيهَا، وَأَمَّا الآخَرُ فَجَلَسَ خَلْفَهُمْ، وَأَمَّا الثَّالِثُ فَأَدْبَرَ ذَاهِبًا، فَلَمَّا فَرَغَ رَسُولُ اللَّهِ صلى الله عليه وسلم قَالَ ‏ "‏ أَلاَ أُخْبِرُكُمْ عَنِ النَّفَرِ الثَّلاَثَةِ أَمَّا أَحَدُهُمْ فَأَوَى إِلَى اللَّهِ، فَآوَاهُ اللَّهُ، وَأَمَّا الآخَرُ فَاسْتَحْيَا، فَاسْتَحْيَا اللَّهُ مِنْهُ، وَأَمَّا الآخَرُ فَأَعْرَضَ، فَأَعْرَضَ اللَّهُ عَنْهُ ‏"‏‏.‏
Reference : Sahih al-Bukhari 66
In-book reference : Book 3, Hadith 8
USC-MSA web (English) reference : Vol. 1, Book 3, Hadith 66
  (deprecated numbering scheme)