The Bodhisatta was once born as ādāsamukha, son of Janasandha, king of Benares. ādāsamukha became king at the age of seven, having successfully solved the problems set him by his courtiers.
Janasandha had a servant named Gāmani-Canda who, being old, retired when ādāsamukha came to the throne. But various mishaps befell Gāmani-Canda, and he was charged on various counts by different people. As he was being brought to the king to receive punishment, he was asked by several persons to convey messages to the king, and to find out from him solutions for their troubles.
The king listened to the charges brought against Gāmani and to his explanation of them. Convinced of Gāmani's innocence, he passed sentences which ultimately brought gain to Gāmani. The king then proceeded to solve the problems contained in the messages brought by Gāmani. He gave to Gāmani the village in which he lived, free from all taxes, and there Gāmani lived happily to the end of his days.
The story was told by the Buddha to certain monks who had been discussing his wisdom.
Gāmani-Canda is identified with Ananda. In the story he is referred to also as Gāmani, Canda-Gāmani and Canda. J.ii.297-310.