The Messenger of Allah ﷺ said, "The young should greet the old, the one passing by should greet the one sitting, and the smaller group should greet the larger group."
حدثنا أحمد بن حنبل حدثنا عبد الرزاق أخبرنا معمر عن همام بن منبة
قال رسول الله ﷺ يسلم الصغير على الكبير والمار على القاعد والقليل على الكثير
Bukhari narrated it in the chapter on greeting, in the section "The few should greet the many," Hadith 6231, from the hadith of Mamar, with this chain. It is also in his Jami, 110/388, Hadith 19445, and in Sahifa Hammam, Hadith 50, and in Musnad Ahmad, 2/314, Hadith, and Baghawi graded it sahih in Sharh al-Sunnah, Hadith 3303.