You are given a tree with vertices numbered .
Choose a vertex and a nonnegative integer . Remove every vertex whose distance from is at most , together with every edge incident to a removed vertex. The distance between two vertices is the number of edges on the unique simple path connecting them.
For every vertex , find the minimum such that the remaining graph has at least two connected components. If no such exists, the answer for is .
The empty graph has zero connected components.
Input
The input is given from Standard Input in the following format:
For every (), there is an edge connecting vertices and .
Output
Let be the answer for vertex . Print on one line, separated by spaces.
Constraints
- .
- ().
- ().
- The given graph is a tree.
Subtasks
Samples
Removing the only vertex leaves the empty graph, so at least two connected components can never remain.
Removing vertex or vertex alone splits the tree into two components. From either leaf, no value of leaves at least two components.