Edge Weight Assignment
Time limit1sMemory limit1024 MB
Given a tree, assign positive edge weights so every leaf-to-leaf path XOR is zero, and find the minimum and maximum count of distinct weights.
Problem
You have an unweighted tree with vertices. Assign a positive weight to each edge so that, for every two different leaves and , the bitwise XOR of the weights of all edges on the simple path between them is . The weights may be very large positive integers, such as . Such an assignment always exists under the given constraints. Let be the number of distinct weights in the assignment. Find the minimum and maximum possible values of for the given tree.

Input
The first line contains an integer (), the number of vertices. Each of the next lines contains two integers and (), meaning there is an edge between and . The given graph is a tree with vertices.
Output
Print two integers: the minimum and the maximum possible value of for a valid assignment of the given tree.
Hint
In the first example, the pictures show one assignment for the minimum and one for the maximum. Each value has several valid assignments. In the second example, the value of is always . In the third example, the pictures show one assignment for the minimum and one for the maximum, and again several valid assignments exist.
