func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MAXN = 1e5 + 7;   const long long INF = 1e9 + 7;   vector<long long> g[MAXN];   bool bad[MAXN];   long long best = -1;   long long besth = -1;   void jfs(long long u, long long parent, long long h) {     if (besth < h) {       best = u;       besth = h;     }     for (long long v : g[u]) {       if (v == parent) continue;       if (bad[v]) continue;       jfs(v, u, h + 1);     }   }   pair<long long, long long> getd(long long u, long long parent, long long h) {     pair<long long, long long> res = {h, u};     for (long long v : g[u]) {       if (v == parent) continue;       if (bad[v]) continue;       pair<long long, long long> nr = getd(v, u, h + 1);       res = max(res, nr);     }     return res;   }   bool go(long long u, long long parent, long long want) {     if (u == want) {       bad[u] = true;       return true;     }     for (long long v : g[u]) {       if (v == parent) continue;       if (go(v, u, want)) {         bad[u] = true;         return true;       }     }     return false;   }   long long dist[MAXN];   void calc(long long u, long long parent, long long h) {     dist[u] = h;     for (long long v : g[u]) {       if (v == parent) continue;       if (bad[v]) continue;       calc(v, u, h + 1);     }   }   long long l[MAXN], r[MAXN], par[MAXN], pos[MAXN];   vector<long long> e;   void build(long long u, long long parent) {     par[u] = parent;     pos[u] = e.size();     e.push_back(u);     l[u] = e.size();     for (long long v : g[u]) {       if (v == parent) continue;       build(v, u);     }     r[u] = e.size() - 1;   }   pair<long long, long long> tree[MAXN * 4];   long long add[MAXN * 4];   void buildt(long long v, long long tl, long long tr) {     if (tl == tr) {       tree[v] = {dist[e[tl]], e[tl]};       return;     }     long long tm = (tl + tr) / 2;     buildt(v * 2 + 1, tl, tm);     buildt(v * 2 + 2, tm + 1, tr);     tree[v] = max(tree[v * 2 + 1], tree[v * 2 + 2]);   }   void push(long long v) {     tree[v * 2 + 1].first += add[v];     add[v * 2 + 1] += add[v];     tree[v * 2 + 2].first += add[v];     add[v * 2 + 2] += add[v];     add[v] = 0;   }   void relax(long long v) { tree[v] = max(tree[v * 2 + 1], tree[v * 2 + 2]); }   void upd(long long v, long long tl, long long tr, long long l, long long r,            long long x) {     if (tr < l || r < tl) return;     if (l <= tl && tr <= r) {       tree[v].first += x;       add[v] += x;       return;     }     long long tm = (tl + tr) / 2;     push(v);     upd(v * 2 + 1, tl, tm, l, r, x);     upd(v * 2 + 2, tm + 1, tr, l, r, x);     relax(v);   }   void del(long long v, long long tl, long long tr, long long p) {     if (tl == tr) {       tree[v].first = -INF;       return;     }     long long tm = (tl + tr) / 2;     push(v);     if (p <= tm) {       del(v * 2 + 1, tl, tm, p);     } else {       del(v * 2 + 2, tm + 1, tr, p);     }     relax(v);   }   void make_bad(long long u, long long n) {     bad[u] = true;     del(0, 0, n - 1, pos[u]);     upd(0, 0, n - 1, l[u], r[u], -1);   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long n;     cin >> n;     if (n == 1) {       cout <<  1 n ;       return 0;     }     for (long long i = 0; i < n - 1; ++i) {       long long u, v;       cin >> u >> v;       g[u - 1].push_back(v - 1);       g[v - 1].push_back(u - 1);     }     pair<long long, long long> t1 = getd(0, 0, 0);     pair<long long, long long> t2 = getd(t1.second, t1.second, 0);     go(t1.second, t1.second, t2.second);     long long curr = t2.first + 1;     cout <<  1   << curr <<    ;     for (long long i = 0; i < n; ++i) dist[i] = -INF;     for (long long i = 0; i < n; ++i) {       if (!bad[i]) continue;       for (long long j : g[i]) {         if (bad[j]) continue;         calc(j, j, 0);       }     }     long long root = t1.second;     build(root, root);     buildt(0, 0, n - 1);     for (long long it = 3; it <= n; ++it) {       if (curr == n) {         for (long long i = 0; i < n - it + 1; ++i) cout << n <<    ;         break;       }       pair<long long, long long> t = tree[0];       curr += t.first + 1;       cout << curr <<    ;       long long u = t.second;       while (!bad[u]) {         make_bad(u, n);         u = par[u];       }     }     cout <<   n ;     return 0;   }   