
Parva 17
Mahaprasthanika Parva
The six of them set out north on foot, and a dog followed
The last journey
Arjuna returned and told them everything, the sinking of Dvaraka, his own defeat, the old strength no longer left in his hands. The Pandavas decided that enough was enough, that their own time was over too. Parikshit was made king, Uttara's son, the one born dead and brought to life by Krishna's word. Then the five brothers and Draupadi set aside their royal garments and set out toward the north, without looking back. On the way the god Agni appeared before them and asked Arjuna to return the Gandiva, the bow belonged to Varuna and it was time to give it back, along with the two quivers whose arrows never ran out. Arjuna, without hesitation, released all three into the water, as though an entire lifetime had been handed back to the sea. And a dog appeared from somewhere and began following them, quietly, uncalled.
One by one
The path climbed upward, toward the Himalayas, hard and long. Draupadi fell first. Bhima asked what wrong she had done, to fall before anyone else. Yudhishthira answered without pausing, that of the five of them she had leaned more toward Arjuna. Then Sahadeva fell, Yudhishthira said he had taken pride in his own intellect, believing no one matched him in understanding. Then Nakula fell, the reason given was pride in his own beauty, believing no one matched him in looks. Then Arjuna fell, Yudhishthira said he had once boasted that he alone would destroy every enemy in a single day, and that had not come true. Then Bhima fell, two reasons were given, pride in his own strength, and that he never thought of others while eating. Each time Bhima asked, astonished, and each time Yudhishthira gave a reason and walked on, without turning back, without stopping, as though even stopping were a weakness.
At last only two remained, Yudhishthira and the dog that had stayed with him the whole way.
The dog and Indra
Then Indra arrived in a shining chariot. He said, come, let us go to heaven, body and all, a rare honor. Yudhishthira said the dog would come too. Indra said dogs do not enter heaven, it was the rule. Yudhishthira said then he would not go either, this dog had stayed with him the entire way and had come to him for refuge, and he could not abandon one who had taken refuge in him, even if it cost him heaven itself. He refused to board the chariot. Then the dog took its true form, it was Dharma, Yudhishthira's own father, the same one who had met him years before disguised as a Yaksha and questioned him.
Note: Parikshit's coronation, the return of the Gandiva, the six setting out on their last journey, falling one by one and the episode of the dog are all in the Mahaprasthanika Parva of Vyasa's Mahabharata. The reasons for the falls come from Yudhishthira's mouth, not from the text's — they are what he says, and the text puts no seal on them. The dog is Dharma, the same one who came as the yaksha in the Vana Parva — so Yudhishthira's first test and his last were set by the same one.
Source: Mahabharata (ascribed by tradition to Vyasa), Mahaprasthanika Parva