12581 - Investigating the Abyss   

Description

You are a great adventurer investingating the abyss.

The abyss can be described as a set of nodes, where each node may connect to some other nodes.

The abyss is known to imprison any creature to deeper levels, i.e., if it is possible to reach node v from node u, then it is impossible to reach node u from node v. However, you are not some ordinary creature, so you are not affected by this during your journey.

The abyss has only one entrance, node 1, and there is exactly one simple path (a path without visiting duplicate nodes) from node 1 to any other node.

You are curious for each node, the number of reachable nodes.

Input

N

X_1 Y_1

X_2 Y_2

...

X_{N-1} Y_{N-1}

 

(N is a positive integer not exceeding 100000, and X_i, Y_i are integers between 1 and N, it is guaranteed that no circular relationship will occur)

(X_i Y_i means there is a path between X_i and Y_i, and the direction is X_i to Y_i).

Output

A_1 A_2 A_3 ... A_N

, where A_i is the number of reachable nodes (excluding i itself) from node i.

Do put a newline character after the last number.

Sample Input  Download

Sample Output  Download

Tags




Discuss