The young should salute the old, the one who is passing by should salute the one who is sitting, and a small company should salute a large one. (Using translation from Abū Dāʾūd 5198)
وَقَالَ رَسُولُ اللهِ ﷺ لِيُسَلِّمِ الصَّغِيرُ عَلَى الْكَبِيرِ وَالْمَارُّ عَلَى الْقَاعِدِ وَالْقَلِيلُ عَلَى الْكَثِيرِ