#include <bits/stdc++.h>   #pragma GCC optimize(3)   using namespace std;   int n, x, y, final, a[100500], dep[100500], maxn, root, f[100500];   std::vector<int> G[100500];   priority_queue<int> Que;   void DFS1(int now, int fa) {     for (int i = 0; i < (int)G[now].size(); i++) {       if (G[now][i] == fa) continue;       dep[G[now][i]] = dep[now] + 1;       DFS1(G[now][i], now);     }     if (dep[now] > maxn) {       root = now;       maxn = dep[now];     }   }   void DFS2(int now, int fa) {     f[now] = 1;     int son = 0;     for (int i = 0; i < (int)G[now].size(); i++) {       if (G[now][i] == fa) continue;       int to = G[now][i];       DFS2(to, now);       if (f[to] + 1 > f[now]) {         f[now] = f[to] + 1;         son = to;       }     }     for (int i = 0; i < (int)G[now].size(); i++)       if (G[now][i] != fa && G[now][i] != son) Que.push(f[G[now][i]]);   }   int main() {     scanf( %d , &n);     for (int i = 1; i < n; i++) {       scanf( %d%d , &x, &y);       G[x].push_back(y);       G[y].push_back(x);     }     dep[1] = 1;     DFS1(1, 0);     DFS2(root, 0);     Que.push(f[root]);     printf( 1  );     for (int i = 2; i <= n; i++) {       int add = 0;       if (!Que.empty()) add = Que.top(), Que.pop();       final += add;       printf( %d  , final);     }     return 0;   }   