Sahih Muslim
The Book on Salutations and Greetings (Kitab As-Salam)
Book Number: 026 / Hadith Number: 5374
Abu Huraira reported Allah's Messenger (may peace be upon him) as saying: The rider should first greet the pedestrian, and the pedestrian the one who is seated and a small group should greet a larger group (with as-Salam-u-'Alaikum).