Codeforces Global Round 6 |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

dfs and similar

graphs

*2900

No tag edit access

The problem statement has recently been changed. View the changes.

×
F. Almost Same Distance

time limit per test

5 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputLet $$$G$$$ be a simple graph. Let $$$W$$$ be a non-empty subset of vertices. Then $$$W$$$ is almost-$$$k$$$-uniform if for each pair of distinct vertices $$$u,v \in W$$$ the distance between $$$u$$$ and $$$v$$$ is either $$$k$$$ or $$$k+1$$$.

You are given a tree on $$$n$$$ vertices. For each $$$i$$$ between $$$1$$$ and $$$n$$$, find the maximum size of an almost-$$$i$$$-uniform set.

Input

The first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 5 \cdot 10^5$$$) – the number of vertices of the tree.

Then $$$n-1$$$ lines follows, the $$$i$$$-th of which consisting of two space separated integers $$$u_i$$$, $$$v_i$$$ ($$$1 \leq u_i, v_i \leq n$$$) meaning that there is an edge between vertices $$$u_i$$$ and $$$v_i$$$.

It is guaranteed that the given graph is tree.

Output

Output a single line containing $$$n$$$ space separated integers $$$a_i$$$, where $$$a_i$$$ is the maximum size of an almost-$$$i$$$-uniform set.

Examples

Input

5 1 2 1 3 1 4 4 5

Output

4 3 2 1 1

Input

6 1 2 1 3 1 4 4 5 4 6

Output

4 4 2 1 1 1

Note

Consider the first example.

- The only maximum almost-$$$1$$$-uniform set is $$$\{1, 2, 3, 4\}$$$.
- One of the maximum almost-$$$2$$$-uniform sets is or $$$\{2, 3, 5\}$$$, another one is $$$\{2, 3, 4\}$$$.
- A maximum almost-$$$3$$$-uniform set is any pair of vertices on distance $$$3$$$.
- Any single vertex is an almost-$$$k$$$-uniform set for $$$k \geq 1$$$.

In the second sample there is an almost-$$$2$$$-uniform set of size $$$4$$$, and that is $$$\{2, 3, 5, 6\}$$$.

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/23/2024 22:29:41 (j1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|