finding the farthest dist b/w any two nodes in undirected tree