Use the tree constructed in question 1 to find the diameter of the tree. Diameter of tree is maximum path length between two end nodes both included. Input format and constraints are same as in question one.
Output Format:
Print a single integer, diameter of the tree.
For given input constructed tree will look like the following:
6
/ \
3 8
/ \ / \
2 5 7 9
/ / \
1 4 10
Nodes in the longest path are 1 2 3 6 8 9 10, hence diameter is 7.