Factor-Full Tree
시간 제한1초메모리 제한1024 MB
루트가 있는 트리의 각 정점에 10^18 이하의 양의 정수를 붙여, 한 정점이 다른 정점의 조상인 경우에만 그 수가 다른 수를 나누도록 만든다.
문제
Aivar is very good at number theory. In fact, it is the only thing he is good at, but this doesn't 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 vertices. In order to deal with such structures, Aivar first constructs a divisor labelling of the tree. A divisor labelling is a way to label each vertex with a positive integer so that is an ancestor of if and only if divides .
After constructing such a labelling, Aivar can simply forget about the tree and just think about the list of numbers .
You are given a rooted tree with vertices, and your task is to find a divisor labelling. The vertices are numbered from to , and is the root.
입력
The first line contains an integer ().
The following lines each contain two integers and (, ), meaning that an edge goes between vertices and . These edges will form a tree.
출력
Print one line with integers, the numbers . These numbers must satisfy . It can be shown that under these constraints, an answer always exists.