Sunan an-Nasa'i #812 · The Book of Leading the Prayer (Al-Imamah)

Sunan an-Nasa'iIt was narrated that Abu Mas'ad Al-Ansari said
Sunan an-Nasa'i · Book 10 · The Book of Leading the Prayer (Al-Imamah)
Sunan an-Nasa'i · كتاب 10 · كتاب الإمامة
"The Messenger of Allah (ﷺ) used to gently pat our shoulders (to make sure the row was straight) at the time of prayer, and he would say: 'Keep (the rows) straight; do not differ from one another lest your hearts should suffer from discord. Let those who are mature and wise stand closest to me, then those who are next to them, then those who are next to them
أَخْبَرَنَا بِشْرُ بْنُ خَالِدٍ الْعَسْكَرِيُّ، قَالَ حَدَّثَنَا غُنْدَرٌ، عَنْ شُعْبَةَ، عَنْ سُلَيْمَانَ، عَنْ عُمَارَةَ بْنِ عُمَيْرٍ، عَنْ أَبِي مَعْمَرٍ، عَنْ أَبِي مَسْعُودٍ، قَالَ كَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم يَمْسَحُ عَوَاتِقَنَا وَيَقُولُ ‏
"‏ اسْتَوُوا وَلاَ تَخْتَلِفُوا فَتَخْتَلِفَ قُلُوبُكُمْ وَلْيَلِيَنِّي مِنْكُمْ أُولُو الأَحْلاَمِ وَالنُّهَى ثُمَّ الَّذِينَ يَلُونَهُمْ ثُمَّ الَّذِينَ يَلُونَهُمْ ‏"‏ ‏.‏
Reference : Sunan an-Nasa'i 812In-book reference : Book 10, Hadith 36