Al-Kāfi - Volume 3 > The Dead Bodies of Men, Women, Children and Slaves (For such Ahadith about an act or issue of the five categories of deeds of the quality of Wujub (Obligatory), Hurmat (Prohibited), Istihbab (Preference), Kirahat (Detestability) or Ibahah (Permissibility) one must consult fatwas of one’s Mujtahid.)
Hadith #1

1ـ عِدَّةٌ مِنْ أَصْحَابِنَا عَنْ سَهْلِ بْنِ زِيَادٍ عَنْ أَحْمَدَ بْنِ مُحَمَّدِ بْنِ أَبِي نَصْرٍ عَنِ الْعَلاَءِ بْنِ رَزِينٍ عَنْ مُحَمَّدِ بْنِ مُسْلِمٍ عَنْ أَبِي جَعْفَرٍ (عَلَيْهِ الْسَّلام) قَالَ سَأَلْتُهُ كَيْفَ يُصَلَّى عَلَى الرِّجَالِ وَالنِّسَاءِ قَالَ يُوضَعُ الرَّجُلُ مِمَّا يَلِي الرِّجَالَ وَالنِّسَاءُ خَلْفَ الرِّجَالِ.

1. A number of our people have narrated from Sahl ibn Ziyad Ahmad ibn Muhammad from ibn abu Nasr from al-‘Ala’ ibn Razin from Muhammad ibn Muslim who has said the following: “I once asked him (the Imam), ‘Alayhi al-Salam, about performing Salah (prayer) for the dead bodies of men and women. He (the Imam) said, ’The dead bodies of men are placed near men and those of women behind the (dead) men.”’