Under construction

Still being built. Things may change

Factor-Full Tree

Time limit1sMemory limit1024 MB

Summary
Given a rooted tree of up to 60 vertices, assign each vertex a number up to 10^18 so that x_v divides x_u exactly when v is an ancestor of u.
Level

Hard8 of 10

Topics
Number theory, Tree, DFS
Solved
No attempts yet

Problem

Aivar is very good at number theory. In fact, it is the only thing he is good at, but this does not stop him from achieving great things. However, if Aivar wants to solve any problem in life, he first needs to convert it to number theory.

For example, consider a rooted tree with NN vertices. To work with such structures, Aivar first constructs a divisor labelling of the tree. A divisor labelling assigns each vertex vv a positive integer xvx_v so that vv is an ancestor of uu if and only if xvx_v divides xux_u.

After constructing such a labelling, Aivar can forget about the tree and consider only the list of numbers x1,x2,…,xNx_1, x_2, \dots, x_N.

You are given a rooted tree with NN vertices. Find a divisor labelling. The vertices are numbered from 11 to NN, and vertex 11 is the root.

Input

The first line contains an integer NN (1≤N≤601 \le N \le 60).

Each of the following N−1N-1 lines contains two integers uu and vv (1≤u,v≤N1 \le u, v \le N, u≠vu \ne v), meaning that an edge connects vertices uu and vv. These edges form a tree.

Output

Print one line with NN integers x1,x2,…,xNx_1, x_2, \dots, x_N. These numbers must satisfy 1≤xi≤10181 \le x_i \le 10^{18}. It has been shown that under these constraints, an answer always exists.

Examples1

  1. Example 1

    Input
    5
    1 2
    1 3
    3 4
    3 5
    
    Expected output
    1 2 3 21 33