#include <bits/stdc++.h>
#define fi first
#define se second
#define all(v) v.begin() , v.end()
#define sz(v) int(v.size())
#define unq(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
using namespace std;
typedef long long ll;
typedef pair<int , int> ii;
typedef pair<long long , int> lli;
const int maxN = int(2e5)+7;
int n;
vector<int> g[maxN] , adj[maxN];
int max_d[maxN] , p[maxN] , cnt[maxN];
void dfs(int u){
max_d[u] = 0;
for (int v : g[u]){
if (v != p[u]){
p[v] = u;
adj[u].push_back(v);
dfs(v);
max_d[u] = max(max_d[u] , max_d[v] + 1);
}
}
}
void solve(){
cin >> n;
for (int i = 1 ; i < n ; i++){
int u , v;
cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
}
p[0] = -1;
dfs(0);
for (int i = 0 ; i < n ; i++){
sort(all(adj[i]) , [](int x , int y){
return max_d[x] > max_d[y];
});
}
set<ii> st;
st.insert({-max_d[0] , 0});
int ans = 0;
while (st.empty() == 0){
int u = st.begin()->se;
st.erase(st.begin());
ans++;
while (true){
if (u != 0) cout << ans << " ";
if (sz(adj[u]) == 0) break;
for (int i = 1 ; i < sz(adj[u]) ; i++){
int v = adj[u][i];
st.insert({-max_d[v] , v});
}
u = adj[u][0];
}
}
}
#define name "A"
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if (fopen(name".INP" , "r")){
freopen(name".INP" , "r" , stdin);
freopen(name".OUT" , "w" , stdout);
}
int t = 1; //cin >> t;
while (t--) solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgZmkgZmlyc3QKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBhbGwodikgdi5iZWdpbigpICwgdi5lbmQoKQojZGVmaW5lIHN6KHYpIGludCh2LnNpemUoKSkKI2RlZmluZSB1bnEodikgc29ydChhbGwodikpOyB2LnJlc2l6ZSh1bmlxdWUoYWxsKHYpKSAtIHYuYmVnaW4oKSk7CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKdHlwZWRlZiBwYWlyPGludCAsIGludD4gaWk7CnR5cGVkZWYgcGFpcjxsb25nIGxvbmcgLCBpbnQ+IGxsaTsKCmNvbnN0IGludCBtYXhOID0gaW50KDJlNSkrNzsKCmludCBuOwp2ZWN0b3I8aW50PiBnW21heE5dICwgYWRqW21heE5dOwppbnQgbWF4X2RbbWF4Tl0gLCBwW21heE5dICwgY250W21heE5dOwoKdm9pZCBkZnMoaW50IHUpewogICAgbWF4X2RbdV0gPSAwOwogICAgZm9yIChpbnQgdiA6IGdbdV0pewogICAgICAgIGlmICh2ICE9IHBbdV0pewogICAgICAgICAgICBwW3ZdID0gdTsKICAgICAgICAgICAgYWRqW3VdLnB1c2hfYmFjayh2KTsKICAgICAgICAgICAgZGZzKHYpOwogICAgICAgICAgICBtYXhfZFt1XSA9IG1heChtYXhfZFt1XSAsIG1heF9kW3ZdICsgMSk7CiAgICAgICAgfQogICAgfQp9Cgp2b2lkIHNvbHZlKCl7CiAgICBjaW4gPj4gbjsKICAgIGZvciAoaW50IGkgPSAxIDsgaSA8IG4gOyBpKyspewogICAgICAgIGludCB1ICwgdjsKICAgICAgICBjaW4gPj4gdSA+PiB2OwogICAgICAgIGdbdV0ucHVzaF9iYWNrKHYpOwogICAgICAgIGdbdl0ucHVzaF9iYWNrKHUpOwogICAgfQogICAgcFswXSA9IC0xOwogICAgZGZzKDApOwogICAgZm9yIChpbnQgaSA9IDAgOyBpIDwgbiA7IGkrKyl7CiAgICAgICAgc29ydChhbGwoYWRqW2ldKSAsIFtdKGludCB4ICwgaW50IHkpewogICAgICAgICAgICAgcmV0dXJuIG1heF9kW3hdID4gbWF4X2RbeV07CiAgICAgICAgfSk7CiAgICB9CiAgICBzZXQ8aWk+IHN0OwogICAgc3QuaW5zZXJ0KHstbWF4X2RbMF0gLCAwfSk7CiAgICBpbnQgYW5zID0gMDsKICAgIHdoaWxlIChzdC5lbXB0eSgpID09IDApewogICAgICAgIGludCB1ID0gc3QuYmVnaW4oKS0+c2U7CiAgICAgICAgc3QuZXJhc2Uoc3QuYmVnaW4oKSk7CiAgICAgICAgYW5zKys7CiAgICAgICAgd2hpbGUgKHRydWUpewogICAgICAgICAgICBpZiAodSAhPSAwKSBjb3V0IDw8IGFucyA8PCAiICI7CiAgICAgICAgICAgIGlmIChzeihhZGpbdV0pID09IDApIGJyZWFrOwogICAgICAgICAgICBmb3IgKGludCBpID0gMSA7IGkgPCBzeihhZGpbdV0pIDsgaSsrKXsKICAgICAgICAgICAgICAgIGludCB2ID0gYWRqW3VdW2ldOwogICAgICAgICAgICAgICAgc3QuaW5zZXJ0KHstbWF4X2Rbdl0gLCB2fSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdSA9IGFkalt1XVswXTsKICAgICAgICB9CiAgICB9Cn0KCiNkZWZpbmUgbmFtZSAiQSIKCmludCBtYWluKCl7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOyBjaW4udGllKDApOyBjb3V0LnRpZSgwKTsKICAgIGlmIChmb3BlbihuYW1lIi5JTlAiICwgInIiKSl7CiAgICAgICAgZnJlb3BlbihuYW1lIi5JTlAiICwgInIiICwgc3RkaW4pOwogICAgICAgIGZyZW9wZW4obmFtZSIuT1VUIiAsICJ3IiAsIHN0ZG91dCk7CiAgICB9CiAgICBpbnQgdCA9IDE7IC8vY2luID4+IHQ7CiAgICB3aGlsZSAodC0tKSBzb2x2ZSgpOwogICAgcmV0dXJuIDA7Cn0KCg==