The Prophet (ﷺ) said, "The young should greet the old, the passer by should greet the sitting one, and the small group of persons should greet the large group of persons. "
Sahih al-Bukhari Book 79, Hadith 5