Ibn 'Abbas (May Allah be pleased with them) reported:
Messenger of Allah (ﷺ) passed by the graves at Al-Madinah. He turned his face towards them and said, "May you be granted safety, O inmates of the graves. May Allah forgive us and you. You have preceded us, and we are to follow."[At-Tirmidhi].
Arabic/English book reference: Book 1, Hadith 584