The Messenger of Allah ﷺ said, "The best of the men's rows is the first and the worst is the last, and the best of the women's rows is the last and the worst is the first."
أخبرنا إسحق بن إبراهيم قال حدثنا جرير عن سهيل عن أبيه
قال رسول الله ﷺ خير صفوف الرجال أولها وشرها آخرها وخير صفوف النساء آخرها وشرها أولها
Reported by Muslim, Prayer, chapter on straightening the rows and establishing them and the merit of the first row and so on, no. 440, from the hadith of Jareer bin Abdul-Hameed with this same chain, and it is also in Kubra, no. 894.