Sunan an-Nasa'i, Book 21, Hadith 201 (In-Book)

It was narrated from Hisham bin 'Amir that the Messenger of Allah said: "Dig graves and dig them well, and bury two or three (together), and put in first the one who knew the Qur'an most."

أَخْبَرَنَا إِبْرَاهِيمُ بْنُ يَعْقُوبَ، قَالَ حَدَّثَنَا مُسَدَّدٌ، قَالَ حَدَّثَنَا عَبْدُ الْوَارِثِ، عَنْ أَيُّوبَ، عَنْ حُمَيْدِ بْنِ هِلاَلٍ، عَنْ أَبِي الدَّهْمَاءِ، عَنْ هِشَامِ بْنِ عَامِرٍ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏:‏ ‏ "‏ احْفِرُوا وَأَحْسِنُوا، وَادْفِنُوا الاِثْنَيْنِ وَالثَّلاَثَةَ، وَقَدِّمُوا أَكْثَرَهُمْ قُرْآنًا ‏" ‏ ‏.‏

sunnah.com