When a group of people pass by, it is sufficient if one of them extends the greetings on their behalf, and it is sufficient if one returns the greeting on behalf of a group.[Abu Dawood]
Original Hadith
«يُجْزِئُ عن الجماعة إذا مَرُّوا أن يُسَلِّم أحدهم, ويُجْزِئُ عن الجماعة أن يَرُدَّ أحدهم».
(أبو داود)