The story of Rama’s life in the third book, Vana Parva – book of the forest, of the Mahabharata.
Yudhishthira lamented the fate of the Pandavas. Sage Markandeya contrasted his fate with that of Rama and thus relativized Yudhishthira’s complaints.