Under construction

Still being built. Things may change

Delegation (Gold)

Time limit2sMemory limit512 MB

Summary
Given a tree with N pastures, decide for each K from 1 to N-1 whether its edges can be split into paths that each have exactly K edges.
Level

Hard8 of 10

Topics
Tree, Dynamic programming, Divide and conquer, Number theory
Solved
No attempts yet

Problem

Farmer John's farm consists of NN pastures (2≤N≤1052 \leq N \leq 10^5) connected by N−1N-1 roads, so that any pasture is reachable from any other pasture. That is, the farm is a tree. After 28 years of dealing with the tricky algorithmic problems that arise from trees, FJ has decided that a tree-shaped farm is too complex. He believes algorithmic problems are simpler on paths.

So he plans to partition the set of roads into several paths and delegate each path to a farm hand. To avoid contention, every path must have the same length. For which lengths does such a partition exist?

For each 1≤K≤N−11 \leq K \leq N-1, determine whether the roads can be partitioned into paths of length exactly KK.

Input

The first line contains a single integer NN. Each of the next N−1N-1 lines contains two integers aa and bb, describing an edge between pastures aa and bb. Both aa and bb are in the range 11 to NN.

Output

Output a bit string of length N−1N-1. The KKth bit from the left is 1 if the edges can be partitioned into paths of length exactly KK, and 0 otherwise.

Hint

The tree can be partitioned into paths of length KK for K=1,2,3K=1,2,3. For K=3K=3, one possible set of paths is 13-12-11-8, 10-9-8-6, 7-6-2-3, 5-4-2-1.

Examples1

  1. Example 1

    Input
    13
    1 2
    2 3
    2 4
    4 5
    2 6
    6 7
    6 8
    8 9
    9 10
    8 11
    11 12
    12 13
    
    Expected output
    111000000000