Saki is interested in various ways to encode a tree into a sequence ever since she has invented Tree++, especially the Prüfer sequence.
Given a tree with $$$N$$$ nodes labelled from $$$0$$$ to $$$N-1$$$, the Prüfer sequence of the tree is the sequence obtained by the following process.
Saki is curious about how much waste will be made on a given tree with nodes numbered from $$$0$$$ to $$$N-1$$$, so she will perform the following action for each $$$k=0, \cdots, N-1$$$.
Saki is very busy, so she has asked you for a favor. Write a program to help Saki compute $$$W_k$$$ for each $$$0 \le k \lt N$$$.
The input is given in the following format:
| $$$N$$$ | |
| $$$U_0$$$ | $$$V_0$$$ |
| $$$U_1$$$ | $$$V_1$$$ |
| $$$\vdots$$$ | |
| $$$U_{N-2}$$$ | $$$V_{N-2}$$$ |
where $$$N$$$ is the number of the nodes in the tree, and the $$$i$$$-th edge connects the nodes $$$U_i$$$ and $$$V_i$$$ for all integer $$$0 \le i \lt N-1$$$.
The input satisfies the following constraints:
The output should be in the following format:
| $$$W_0$$$ |
| $$$W_1$$$ |
| $$$\vdots$$$ |
| $$$W_{N-1}$$$ |
where $$$W_k$$$ is the waste of the tree when node $$$u$$$ is labelled with $$$u+k \mod N$$$.
70 30 40 61 42 43 5
6 10 8 9 7 8 11