The Messenger of Allah ﷺ said, "Let those of maturity and understanding stand directly behind me, then those next to them, then those next to them."
حدثنا ابن كثير أخبرنا سفيان عن الأعمش عن عمارة بن عمير عن أبي معمر
قال رسول الله ﷺ ليلني منكم أولو الأحلام والنهى ثم الذين يلونهم ثم الذين يلونهم
Muslim reported it, chapter on straightening rows and establishing them and the merit of the first row and so on, hadith 432, from the hadith of Sufyan by this same route, and Shubah followed him in agreement in Nasai, hadith 813, and elsewhere.