Given a tree containing nodes, print the maximum depth of the tree if the tree can be rooted at any node.
The maximum depth of a tree rooted at a certain node is defined as the maximal number of edges in the path that begins at .
Input Specification
The first line will contain the integer , the number of nodes.
The next lines will each contain integers, , indicating nodes and are connected by a single edge. It is guaranteed the entire tree is connected.
Output Specification
On the first line, output integers, the maximum depth of the tree, and the node to root the tree at. If there are multiple such nodes, print the one with the smallest index.
Sample Input
5
2 1
1 3
1 4
3 5
Sample Output
3 2
Explanation for Sample
If the tree was rooted at node , the maximum depth would be .
Comments