Valmiki Ramayana Ayodhya Kanda Sarga 72 Shloka 36
Original Shlokaरामेति राजा विलपन् हा सीते लक्ष्मणेति च। स महात्मा परं लोकं गतो गतिमतां वरः।।2.72.36।।
1 source checked for this shloka
गतिमताम् among those who attained the excellent state, वरः the foremost, महात्मा magnanimous, सः that, राजा king, रामेति O Rama, हा सीते O Sita, लक्ष्मणेति च O Lakshmana also, विलपन् lamenting, परं लोकम् to the other world, गतः went.
The magnanimous king, the foremost of those who attained the excellent state after, death, went to the other world, lamenting 'O Rama, O Sita, O Lakshamana'.