#include <bits/stdc++.h>   using namespace std;   const int inf = (int)2e9;   const long long mod = 1000000007;   int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};   long long powmod(long long a, long long p) {     long long ans = 1;     a %= mod;     while (p) {       if (p & 1) ans *= a;       p /= 2;       a *= a;       ans %= mod;       a %= mod;     }     return ans;   }   long long mdinv(long long a) { return powmod(a, mod - 2); }   const int N = 5e5 + 10;   vector<int> adj[N];   vector<int> pre[N];   vector<int> suf[N];   int d[N];   vector<pair<int, int> > nb[N];   int f[2 * N];   void dfs1(int i, int p) {     d[i] = 0;     for (int v : adj[i]) {       if (v != p) {         dfs1(v, i), d[i] = max(d[i], 1 + d[v]);       }     }   }   void evaluate(vector<pair<int, int> >& v);   void go(vector<pair<int, int> >& v, vector<pair<int, int> >& v2);   void dfs2(int i, int p, int parDep) {     vector<int>& pr = pre[i];     for (int v : adj[i]) {       if (v != p) {         pr.push_back(d[v] + 1);       } else         pr.push_back(parDep + 1);     }     vector<int> lst(pr);     vector<int>& sf = suf[i];     sf = pr;     for (int i = 1; i < (int)(pr.size()); i++) pr[i] = max(pr[i - 1], pr[i]);     for (int i = (int)(pr.size()) - 2; i >= 0; i--) sf[i] = max(sf[i], sf[i + 1]);     for (int first = 0; first < (int)(adj[i].size()); first++) {       int v = adj[i][first];       if (v == p) continue;       int mx = 0;       if (first) mx = max(mx, pr[first - 1]);       if (first + 1 < (int)(pr.size())) mx = max(mx, sf[first + 1]);       dfs2(v, i, mx);     }     for (int first : lst) nb[i].push_back({first, 1});     vector<pair<int, int> >& v = nb[i];     sort((v).begin(), (v).end());     int ind = 0;     for (int i = 1; i < (int)(v.size()); i++) {       if (v[ind].first == v[i].first) {         v[ind].second += v[i].second;       } else {         ind++;         v[ind] = v[i];       }     }     v.resize(ind + 1);     evaluate(nb[i]);     for (int v : adj[i]) {       if (v != p) {         go(nb[i], nb[v]);       }     }   }   vector<pair<int, int> > tmp;   void evaluate(vector<pair<int, int> >& v) {     tmp = v;     for (int i = (int)(tmp.size()) - 1; i >= 0; i--) {       if (i != (int)(tmp.size()) - 1)         tmp[i].second = tmp[i].second + tmp[i + 1].second;       int dep = tmp[i].first;       f[2 * dep] = max(f[2 * dep], tmp[i].second);       int greater = tmp[i].second - v[i].second;       f[2 * dep + 1] = max(f[2 * dep + 1], greater + 1);       f[2 * dep - 1] = max(f[2 * dep - 1], tmp[i].second);     }   }   void go(vector<pair<int, int> >& v1, vector<pair<int, int> >& v2) {     tmp.clear();     for (auto i : v1) tmp.push_back(i);     for (auto i : v2) tmp.push_back(i);     sort((tmp).begin(), (tmp).end());     int ind = 0;     for (int i = 1; i < (int)(tmp.size()); i++) {       if (tmp[ind].first == tmp[i].first) {         tmp[ind].second += tmp[i].second;       } else {         ind++;         tmp[ind] = tmp[i];       }     }     tmp.resize(ind + 1);     for (int i = (int)(tmp.size()) - 1; i >= 0; i--) {       if (i != (int)(tmp.size()) - 1)         tmp[i].second = tmp[i].second + tmp[i + 1].second;       int dep = tmp[i].first;       f[2 * dep] = max(f[2 * dep], tmp[i].second - 2);     }   }   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     for (int i = 0; i < (int)2 * N; i++) f[i] = 1;     int n;     cin >> n;     int a, b;     int mxd = 0;     for (int i = 0; i < (int)n - 1; i++) {       cin >> a >> b;       adj[a].push_back(b);       adj[b].push_back(a);     }     for (int i = 1; i <= n; i++) mxd = max(mxd, (int)(adj[i].size()));     dfs1(1, 0);     dfs2(1, 0, -1);     for (int i = N - 3; i >= 0; i -= 2) f[i] = max(f[i], f[i + 2]);     for (int i = N - 4; i >= 0; i -= 2) f[i] = max(f[i], f[i + 2]);     f[1] = mxd + 1;     for (int i = 1; i <= n; i++) cout << f[i] <<    ;   }