The problem is based on diameter of the tree, the diameter of the tree is is defined as a longest path or route between any two nodes in a tree. So there may be many pairs( u , v ) which have length equals to the diameter of the tree , once you find any node which is one end of the diameter then the node which present at maximum distance to it is another end of the diameter , and if you calculating this again and again , till you encounter the visited leaf again , then each and every time , you will go to new end of the diameter and each time you get the same distance. It means if you start with any leaf node u1 then it is not necessary that this node is one end of the diameter, now u2 is the node which is at maximum distance to it.. then definitely u2 node is one end of the diameter and u3 is maximum distance node to it (u2 - u3 ) is the diameter. and now if you proceed further, you will get the the same distance again and again till the last node....
So for some tree it will give x , y , y , y , y , y ..... where
x < y ( means initial starting node is not the end of diameter )
Otherwise it will give y , y , y , y , y... ( y = diameter ).
Option C is the correct answer.