Sayyiduna Abu Mas'ud (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings be upon him) used to say: "Let those of you who have intelligence and understanding stand closest to me, then those who come after them, then those who come after them."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 14667