On the authority of Abu Huraira, may God be pleased with him, he said:
▫ The Messenger of God, peace and blessings be upon him, said:
"The best lines for men are the first and the worst are the last, and the best lines for women are the last and the worst are the first."
Narrated by Muslim 440.
Male ranks:
The best of them is the first and the worst is the last: that is, the first row is the most rewarded and virtuous due to its proximity to the imam and their eagerness to do good, and the later the row, the relatively less reward.
Women's ranks:
The best is the last and the worst is the first:.
If they are in the same place with the men (without barriers): the last rows are better and more rewarding because they are far from mixing with men and seeing them and avoiding temptation, and the first rows are bad because they are close to men.
If they are in a separate place or in the presence of a barrier (hidden from men): in this case, they are like men. The best of their rows is the first and the worst is the last, and it is recommended that they complete the first rows and close the private parts.