Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EISTRSZ - Subtree nodes

Given a tree of n nodes in which node 0 is root. Your task is to print out the number of nodes in all subtrees.

Input

The first line contains an integer (0 < n ≤ 105).

Each of the next n-1 lines contains two integers a, b representing an edge that connects vertex a and vertex b (0 ≤ a, b < n).

Output

For each node V in the tree in ascending order, output the number of nodes in subtree in which V is the root.

Example

https://drive.google.com/file/d/1X6H7qsDtMpeeb0OoSlZoLlRZt3qnGc_O/view?usp=sharing

Input:
6 
0 1
0 2
2 3
2 4
1 5


Output:
0 6
1 2
2 3
3 1
4 1
5 1


Added by:Ha Minh Ngoc
Date:2021-07-21
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.