#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

int N;
vector<int> lgtail;
vector<int> uptail;

vector<vector<int>> e;
vector<int> par;

vector<vector<int>> tails;

void dfs_tail(int now, int prv)
{
    par[now] = prv;
    for (auto nxt : e[now]) if (nxt != prv)
    {
        dfs_tail(nxt, now);
        mmax(lgtail[now], lgtail[nxt] + 1);
    }
}
void dfs_uptail(int now, int prv, int len=0)
{
    for (auto nxt : e[now]) if (nxt != prv) tails[now].push_back(lgtail[nxt] + 1);
    if (prv >= 0)
    {
        uptail[now] = max(uptail[prv], len) + 1;
        tails[now].push_back(uptail[now]);
    }
    sort(ALL(tails[now]));
    vector<pint> l2id{{0, -1}};
    for (auto nxt : e[now]) if (nxt != prv) l2id.emplace_back(lgtail[nxt] + 1, nxt);
    sort(l2id.rbegin(), l2id.rend());

    for (auto nxt : e[now]) if (nxt != prv)
    {
        int i = 0;
        if (l2id[i].second == nxt) i++;
        dfs_uptail(nxt, now, l2id[i].first);
    }
}

int main()
{
    cin >> N;
    e.resize(N);
    REP(i, N - 1)
    {
        int u, v;
        cin >> u >> v;
        u--, v--;
        e[u].emplace_back(v);
        e[v].emplace_back(u);
    }
    par.resize(N, -1);
    lgtail.resize(N);
    dfs_tail(0, -1);

    tails.resize(N);
    uptail.resize(N);
    dfs_uptail(0, -1);
    // tails.resize(N);
    // dfs2_tails(0, -1);
    // dbg(uptail);
    // dbg(tails);
    vector<int> ret(N * 2 + 3, 1);
    REP(i, N) mmax(ret[1], (int)e[i].size() + 1);
    REP(i, N) mmax(ret[2], (int)e[i].size());

    REP(i, N) {
        int d = tails[i].size();
        REP(j, d - 1)
        {
            int a = min(tails[i][j], tails[i][j + 1] - 1) * 2 + 1;
            if (a > 1) mmax(ret[a], d - j);
        }
    }

    FOR(c, 1, N) {
        int p = par[c];
        vector<int> vec;
        int dllg = lgtail[c] + 1;
        bool flg = true;
        for (auto v : tails[p]) {
            if (flg and v == dllg)
            {
                flg = false;
                continue;
            }
            vec.push_back(v);
        }
        dllg = uptail[c];
        flg = true;
        for (auto v : tails[c]) {
            if (flg and v == dllg)
            {
                flg = false;
                continue;
            }
            vec.push_back(v);
        }
        sort(ALL(vec));
        // dbg(c);
        // dbg(tails[p]);
        // dbg(tails[c]);
        // dbg(dllg);
        // dbg(vec);
        REP(j, vec.size()) {
            mmax(ret[vec[j] * 2], (int)vec.size() - j);
        }
        // dbg(ret);
    }

    IREP(i, N) mmax(ret[i], ret[i + 2]);
    FOR(i, 1, N + 1) printf("%d ", ret[i]);
    puts("");
}


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos;
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs!=lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    if(L[c]==x)return c;
    for(int i=19;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.rbegin(),tmp.rend());
       int toxic[2];
       toxic[0]=-1;
       toxic[1]=-1;
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          if(toxic[x^1]!=-1)
          {
             int lca=lca_query(toxic[x^1],c);
             int f=findo(c,L[lca]+1);
             int g=findo(toxic[x^1],L[lca]+1);
             if(lca==c||lca==toxic[x^1]);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
          }
          }
          toxic[x]=c;

       }

    }

    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }

}


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos,en[mx];
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    en[v]=pos;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs<lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    if(L[c]==x)return c;
    for(int i=20;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int lo_bo(int v,int c)
{
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   if(g==chum[v].size()==0||chum[v][g].fs!=c)return 0;
   return 1;

}
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.begin(),tmp.end());
       vector<int>toxic2[2];
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          int r=-1;
          for(int j=(int)toxic2[x^1].size()-1;j>=0;j--)
          {
             int w=toxic2[x^1][j];
               if(start[w]<=start[c]&&en[w]>=start[c])continue;
               r=w;
               break;

          }
          if(r!=-1)
          {
             int lca=lca_query(r,c);
             int f=findo(c,L[lca]+1);
             int g=findo(r,L[lca]+1);
             if(lca==c||lca==r);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);

              int ko=query_bin(lca,i+1-L[lca]);
              if(parentanse[lca]>=i+1-L[lca])ko++;
              if(lo_bo(lca,i-L[lca])||parentanse[lca]==i-L[lca]);
              else ko--;
              ans[i+1+i-2*L[lca]]=max(ans[i+1+i-2*L[lca]],ko+1);
          }
          }
          toxic2[x].pb(c);

       }

    }
    for(int i=1;i<=n;i++)
    {
      ans[1]=max(ans[1],(int)vc[i].size()+1);
    }
    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }

}


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos,en[mx];
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    en[v]=pos;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs<lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    if(L[c]==x)return c;
    for(int i=20;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int lo_bo(int v,int c)
{
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   if(g==chum[v].size()==0||chum[v][g].fs!=c)return 0;
   return 1;

}
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.begin(),tmp.end());
       vector<int>toxic2[2];
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          int r=-1;
          for(int j=(int)toxic2[x^1].size()-1;j>=0;j--)
          {
             int w=toxic2[x^1][j];
             if(start[w]>start[c]||en[w]<start[c]){
               r=w;
               break;
             }
          }
          if(r!=-1)
          {
             int lca=lca_query(r,c);
             int f=findo(c,L[lca]+1);
             int g=findo(r,L[lca]+1);
             if(lca==c||lca==r);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);

              int ko=query_bin(lca,i+1-L[lca]);
              if(parentanse[lca]>=i+1-L[lca])ko++;
              if(lo_bo(lca,i-L[lca])||parentanse[lca]==i-L[lca]);
              else ko--;
              ans[i+1+i-2*L[lca]]=max(ans[i+1+i-2*L[lca]],ko+1);
          }
          }
          toxic2[x].pb(c);

       }

    }
    for(int i=1;i<=n;i++)
    {
      ans[1]=max(ans[1],(int)vc[i].size()+1);
    }
    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }

}


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos,en[mx];
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    en[v]=pos;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs<lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    assert(L[c]>=x);
    if(L[c]==x)return c;
    for(int i=20;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int lo_bo(int v,int c)
{
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   if(g==chum[v].size()||chum[v][g].fs!=c)return 0;
   return 1;

}
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       //sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.begin(),tmp.end());
       vector<int>toxic2[2];
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          int r=-1;
          for(int j=(int)toxic2[x^1].size()-1;j>=0;j--)
          {
             int w=toxic2[x^1][j];
               if(start[w]<=start[c]&&en[w]>=start[c])continue;
               r=w;
               break;

          }
          if(r!=-1)
          {
             int lca=lca_query(r,c);
             int f=findo(c,L[lca]+1);
             int g=findo(r,L[lca]+1);
             if(lca==c||lca==r);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             assert(L[f]-L[lca]==1&&L[g]-L[lca]==1);
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);

              int ko=query_bin(lca,i+1-L[lca]);
              if(parentanse[lca]>=i+1-L[lca])ko++;
              if(lo_bo(lca,i-L[lca])||parentanse[lca]==i-L[lca]);
              else ko--;
              ans[i+1+i-2*L[lca]]=max(ans[i+1+i-2*L[lca]],ko+1);
          }
          }
          toxic2[x].pb(c);

       }

    }
    for(int i=1;i<=n;i++)
    {
      ans[1]=max(ans[1],(int)vc[i].size()+1);
    }
    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }
}

/*
8
5 6
6 1
1 2
1 3
3 4
1 7
7 8

*/


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos;
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs!=lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    if(L[c]==x)return c;
    for(int i=19;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       sort(chum[i].begin(),chum[i].end());
    }
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.rbegin(),tmp.rend());
       int toxic[2];
       toxic[0]=-1;
       toxic[1]=-1;
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          if(toxic[x^1]!=-1)
          {
             int lca=lca_query(toxic[x^1],c);
             int f=findo(c,L[lca]+1);
             int g=findo(toxic[x^1],L[lca]+1);
             if(lca==c||lca==toxic[x^1]);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             int koyta=query_bin(tar,i);
              koyta+=query_bin(lca,i);
              koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i);
              koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
          }
          }
          toxic[x]=c;

       }

    }

    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }

}


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos;
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs!=lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    if(L[c]==x)return c;
    for(int i=19;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.rbegin(),tmp.rend());
       int toxic[2];
       toxic[0]=-1;
       toxic[1]=-1;
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          if(toxic[x^1]!=-1)
          {
             int lca=lca_query(toxic[x^1],c);
             int f=findo(c,L[lca]+1);
             int g=findo(toxic[x^1],L[lca]+1);
             if(lca==c||lca==toxic[x^1]);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
          }
          }
          toxic[x]=c;

       }

    }
    for(int i=1;i<=n;i++)
    {
      ans[1]=max(ans[1],(int)vc[i].size()+1);
    }
    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }

}


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos,en[mx];
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    en[v]=pos;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs<lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    assert(L[c]>=x);
    if(L[c]==x)return c;
    for(int i=20;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int lo_bo(int v,int c)
{
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   if(g==chum[v].size()||chum[v][g].fs!=c)return 0;
   return 1;

}
int jargon[mx];
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       //sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.begin(),tmp.end());
       vector<int>toxic2[2];
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          int r=-1;
          for(int j=(int)toxic2[x^1].size()-1;j>=0;j--)
          {
             int w=toxic2[x^1][j];
               if(start[w]<=start[c]&&en[w]>=start[c])continue;
               r=w;
               break;

          }
          if(r!=-1)
          {
             int lca=lca_query(r,c);
             int f=findo(c,L[lca]+1);
             int g=findo(r,L[lca]+1);
             if(lca==c||lca==r);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             assert(L[f]-L[lca]==1&&L[g]-L[lca]==1);
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);

              int ko=query_bin(lca,i+1-L[lca]);
              if(parentanse[lca]>=i+1-L[lca])ko++;
              if(lo_bo(lca,i-L[lca])||parentanse[lca]==i-L[lca]);
              else ko--;
              ans[i+1+i-2*L[lca]]=max(ans[i+1+i-2*L[lca]],ko+1);
          }
          }
          toxic2[x].pb(c);

       }

    }
    for(int i=1;i<=n;i++)
    {

       if(parentanse[i]>-1)mylist[i].insert(mp(parentanse[i],P[i][0]));
       int c=mylist[i].size();
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           pii rs=*it;
          // if(rs.fs+rs.fs-1>dia)continue;
           jargon[min(rs.fs+rs.fs-1,n)]=max(jargon[min(rs.fs+rs.fs-1,n)],c);
           c--;
       }

    }
    for(int i=n;i>=1;i--)
    {
       jargon[i]=max(jargon[i+1],jargon[i]);
       if(i&1)ans[i]=max(ans[i],jargon[i]);

    }
    for(int i=1;i<=n;i++)
    {
      ans[1]=max(ans[1],(int)vc[i].size()+1);
    }
    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }
}

/*
8
5 6
6 1
1 2
1 3
3 4
1 7
7 8

*/


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos,en[mx];
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    en[v]=pos;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs<lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    assert(L[c]>=x);
    if(L[c]==x)return c;
    for(int i=20;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int lo_bo(int v,int c)
{
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   if(g==chum[v].size()||chum[v][g].fs!=c)return 0;
   return 1;

}
int jargon[mx];
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       //sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.begin(),tmp.end());
       vector<int>toxic2[2];
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          int r=-1;
          for(int j=(int)toxic2[x^1].size()-1;j>=0;j--)
          {
             int w=toxic2[x^1][j];
               if(start[w]<=start[c]&&en[w]>=start[c])continue;
               r=w;
               break;

          }
          if(r!=-1)
          {
             int lca=lca_query(r,c);
             int f=findo(c,L[lca]+1);
             int g=findo(r,L[lca]+1);
             if(lca==c||lca==r);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             assert(L[f]-L[lca]==1&&L[g]-L[lca]==1);
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);

              int ko=query_bin(lca,i+1-L[lca]);
              if(parentanse[lca]>=i+1-L[lca])ko++;
              if(lo_bo(lca,i-L[lca])||parentanse[lca]==i-L[lca]);
              else ko--;
              ans[i+1+i-2*L[lca]]=max(ans[i+1+i-2*L[lca]],ko+1);
          }
          }
          toxic2[x].pb(c);

       }

    }
    for(int i=1;i<=n;i++)
    {

       if(parentanse[i]>-1)mylist[i].insert(mp(parentanse[i],P[i][0]));
       int c=mylist[i].size();
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           pii rs=*it;
           if(rs.fs+rs.fs-1>dia)continue;
           jargon[rs.fs+rs.fs-1]=max(jargon[rs.fs+rs.fs-1],c);
           c--;
       }

    }
    for(int i=n;i>=1;i--)
    {
       jargon[i]=max(jargon[i+1],jargon[i]);
       if(i&1)ans[i]=max(ans[i],jargon[i]);

    }
    for(int i=1;i<=n;i++)
    {
      ans[1]=max(ans[1],(int)vc[i].size()+1);
    }
    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }
}

/*
8
5 6
6 1
1 2
1 3
3 4
1 7
7 8

*/


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos,en[mx];
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    en[v]=pos;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs<lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    assert(L[c]>=x);
    if(L[c]==x)return c;
    for(int i=20;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int lo_bo(int v,int c)
{
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   if(g==chum[v].size()||chum[v][g].fs!=c)return 0;
   return 1;

}
int cnt[mx];
int jargon[mx];
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       //sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.begin(),tmp.end());
       vector<int>toxic2[2];
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          int r=-1;
          for(int j=(int)toxic2[x^1].size()-1;j>=0;j--)
          {
             int w=toxic2[x^1][j];
               if(start[w]<=start[c]&&en[w]>=start[c])continue;
               r=w;
               break;

          }
          if(r!=-1)
          {
             int lca=lca_query(r,c);
             int f=findo(c,L[lca]+1);
             int g=findo(r,L[lca]+1);
             if(lca==c||lca==r);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             assert(L[f]-L[lca]==1&&L[g]-L[lca]==1);
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);

              int ko=query_bin(lca,i+1-L[lca]);
              if(parentanse[lca]>=i+1-L[lca])ko++;
              if(lo_bo(lca,i-L[lca])||parentanse[lca]==i-L[lca]);
              else ko--;
              ans[i+1+i-2*L[lca]]=max(ans[i+1+i-2*L[lca]],ko+1);
          }
          }
          toxic2[x].pb(c);

       }

    }
    for(int i=1;i<=n;i++)
    {

       if(parentanse[i]>-1)mylist[i].insert(mp(parentanse[i],P[i][0]));
       int c=mylist[i].size();
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
          pii rs=*it;
          cnt[rs.fs]++;
       }
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           pii rs=*it;
          // if(rs.fs+rs.fs-1>dia)continue;
           jargon[min(rs.fs+rs.fs-1,n)]=max(jargon[min(rs.fs+rs.fs-1,n)],c);
           int ff=cnt[rs.fs+1];
           jargon[min(rs.fs+rs.fs+1,n)]=max(jargon[min(rs.fs+rs.fs+1,n)],ff+1);
           c--;
       }
         for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
          pii rs=*it;
          cnt[rs.fs]--;
       }

    }
    for(int i=n;i>=1;i--)
    {
       jargon[i]=max(jargon[i+1],jargon[i]);
       if(i&1)ans[i]=max(ans[i],jargon[i]);

       ans[i]=max(ans[i],ans[i+2]);

    }
    for(int i=1;i<=n;i++)
    {
      ans[1]=max(ans[1],(int)vc[i].size()+1);
    }
    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }
}

/*
8
5 6
6 1
1 2
1 3
3 4
1 7
7 8

*/


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos,en[mx];
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    en[v]=pos;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs<lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    if(L[c]==x)return c;
    for(int i=20;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int lo_bo(int v,int c)
{
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   if(g==chum[v].size()||chum[v][g].fs!=c)return 0;
   return 1;

}
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.begin(),tmp.end());
       vector<int>toxic2[2];
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          int r=-1;
          for(int j=(int)toxic2[x^1].size()-1;j>=0;j--)
          {
             int w=toxic2[x^1][j];
               if(start[w]<=start[c]&&en[w]>=start[c])continue;
               r=w;
               break;

          }
          if(r!=-1)
          {
             int lca=lca_query(r,c);
             int f=findo(c,L[lca]+1);
             int g=findo(r,L[lca]+1);
             if(lca==c||lca==r);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);

              int ko=query_bin(lca,i+1-L[lca]);
              if(parentanse[lca]>=i+1-L[lca])ko++;
              if(lo_bo(lca,i-L[lca])||parentanse[lca]==i-L[lca]);
              else ko--;
              ans[i+1+i-2*L[lca]]=max(ans[i+1+i-2*L[lca]],ko+1);
          }
          }
          toxic2[x].pb(c);

       }

    }
    for(int i=1;i<=n;i++)
    {
      ans[1]=max(ans[1],(int)vc[i].size()+1);
    }
    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }

}


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos,en[mx];
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    en[v]=pos;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs<lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    assert(L[c]>=x);
    if(L[c]==x)return c;
    for(int i=20;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int lo_bo(int v,int c)
{
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   if(g==chum[v].size()||chum[v][g].fs!=c)return 0;
   return 1;

}
int jargon[mx];
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       //sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.begin(),tmp.end());
       vector<int>toxic2[2];
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          int r=-1;
          for(int j=(int)toxic2[x^1].size()-1;j>=0;j--)
          {
             int w=toxic2[x^1][j];
               if(start[w]<=start[c]&&en[w]>=start[c])continue;
               r=w;
               break;

          }
          if(r!=-1)
          {
             int lca=lca_query(r,c);
             int f=findo(c,L[lca]+1);
             int g=findo(r,L[lca]+1);
             if(lca==c||lca==r);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             assert(L[f]-L[lca]==1&&L[g]-L[lca]==1);
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);

              int ko=query_bin(lca,i+1-L[lca]);
              if(parentanse[lca]>=i+1-L[lca])ko++;
              if(lo_bo(lca,i-L[lca])||parentanse[lca]==i-L[lca]);
              else ko--;
              ans[i+1+i-2*L[lca]]=max(ans[i+1+i-2*L[lca]],ko+1);
          }
          }
          toxic2[x].pb(c);

       }

    }
    for(int i=1;i<=n;i++)
    {

       if(parentanse[i]>-1)mylist[i].insert(mp(parentanse[i],P[i][0]));
       int c=mylist[i].size();
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           pii rs=*it;
          // if(rs.fs+rs.fs-1>dia)continue;
           jargon[min(rs.fs+rs.fs-1,n)]=max(jargon[min(rs.fs+rs.fs-1,n)],c);
           c--;
       }

    }
    for(int i=n;i>=1;i--)
    {
       jargon[i]=max(jargon[i+1],jargon[i]);
       if(i&1)ans[i]=max(ans[i],jargon[i]);

       ans[i]=max(ans[i],ans[i+2]);

    }
    for(int i=1;i<=n;i++)
    {
      ans[1]=max(ans[1],(int)vc[i].size()+1);
    }
    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }
}

/*
8
5 6
6 1
1 2
1 3
3 4
1 7
7 8

*/


#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pii pair<int,int>
#define mx 700000
#define ll long long

vector<int>ara[mx];
set<pii>mylist[mx],query[mx];
int P[mx][22],L[mx],ans[mx],len[mx];
int parentanse[mx];
pii roo;
int dia=0;
vector<int>vc[mx];
int start[mx],pos;
int dfs(int v,int par,int lev)
{
    ara[lev].pb(v);
    start[v]=++pos;
    L[v]=lev;
    P[v][0]=par;
    dia=max(dia,lev);
    roo=max(roo,mp(lev,v));
    int ret=0;
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        int x=dfs(w,v,lev+1);
        ret=max(ret,x);

        mylist[v].insert(mp(x,w));
    }
    len[v]=ret;
    return ret+1;
}
void dfs2(int v,int par,int ansi)
{
    parentanse[v]=ansi;
    ansi=max(ansi,0);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
            set<pii>::iterator it;
        mylist[v].erase(mp(len[w]+1,w));
        int c=ansi;
        if(mylist[v].size())
        {
            it=mylist[v].end();
            it--;
            pii ps=*it;
            c=max(c,ps.fs);
        }
        dfs2(w,v,c+1);
        mylist[v].insert(mp(len[w]+1,w));
    }
}
void dfs3(int v,int par,int lev)
{
    dia=max(dia,lev);
    for(int i=0; i<vc[v].size(); i++)
    {
        int w=vc[v][i];
        if(w==par)
            continue;
        dfs3(w,v,lev+1);
    }
}
int lca_query(int p, int q)
{
    int tmp, log, i;

    if (L[p] < L[q])
        tmp = p, p = q, q = tmp;

    log=1;
    while(1)
    {
        int next=log+1;
        if((1<<next)>L[p])
            break;
        log++;

    }

    for (i = log; i >= 0; i--)
        if (L[p] - (1 << i) >= L[q])
            p = P[p][i];

    if (p == q)
        return p;

    for (i = log; i >= 0; i--)
        if (P[p][i] != -1 && P[p][i] != P[q][i])
            p = P[p][i], q = P[q][i];

    return P[p][0];
}
void prc(set<int>&dum,set<pii>&my,int lev,int v)
{
   ans[lev*2-L[v]*2]=max(ans[lev*2-L[v]*2],(int)dum.size());
   int g= dum.size();

   if(my.size())
   {
      set<pii>::iterator it3;
      it3=my.end();
      it3--;
      pii rs=*it3;
      if(rs.fs<lev-1-L[v])g--;
   }
   else g--;
   ans[lev-1+lev-L[v]*2]=max(ans[lev-1+lev-L[v]*2],g+1);
}
void process(int v)
{
    set<pii>::iterator it,it2;
    set<int>::iterator it3;
    for(it=query[v].begin();it!=query[v].end();)
    {
        it2=it;
        pii ps=*it;
        set<int>dum;
      //  cout<<ps.fs<<endl;
        for(;it2!=query[v].end();it2++)
        {
           pii rs=*it2;
           if(rs.fs!=ps.fs)break;
           mylist[v].erase({len[rs.sc]+1,rs.sc});
           dum.insert(rs.sc);
        }
      //  cout<<dum.size()<<endl;
        mylist[v].insert(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v])dum.insert(P[v][0]);
        else mylist[v].insert(mp(parentanse[v],P[v][0]));
        prc(dum,mylist[v],ps.fs,v);
        mylist[v].erase(mp(0,v));
        if(parentanse[v]>=ps.fs-L[v]);
        else mylist[v].erase(mp(parentanse[v],P[v][0]));
        it=it2;
        for(it3=dum.begin();it3!=dum.end();it3++)
        {
           int gs=*it3;
           if(gs==P[v][0])continue;
           mylist[v].insert(mp(len[gs]+1,gs));
        }
    }
}
int findo(int c,int x)
{
    if(L[c]==x)return c;
    for(int i=19;i>=0;i--)
    {
       if(P[c][i]==-1)continue;
       if(L[P[c][i]]>x){
         c=P[c][i];
       }
    }
    return P[c][0];

}
#define tii pair<pii,int>
vector<pii>chum[mx];
int query_bin(int v,int c)
{
   int x=chum[v].size();
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   return x-g;
}
int lo_bo(int v,int c)
{
   int g=upper_bound(chum[v].begin(),chum[v].end(),mp(c-1,INT_MAX))-chum[v].begin();
   if(g==chum[v].size()==0||chum[v][g].fs!=c)return 0;
   return 1;

}
int main()
{
    memset(P,-1,sizeof P);

    int n,l,k;
    cin>>n;
    for(int i=1;i<n;i++)
    {
       scanf("%d%d",&l,&k);
       vc[l].pb(k);
       vc[k].pb(l);
    }
     dfs(1,-1,0);
    dfs2(1,-1,-1);
    dfs3(roo.sc,-1,0);
    for(int j=1; (1<<j)<=n; j++)
    {
        for(int i=1; i<=n; i++)
        {
            if(P[i][j-1]==-1)
                continue;
            P[i][j]=P[P[i][j-1]][j-1];
        }
    }
  //  cout<<ara[1].size()<<endl;
    for(int i=0; i<=n; i++)
    {
        for(int j=1; j<ara[i].size(); j++)
        {
            int lc=lca_query(ara[i][j-1],ara[i][j]);
            query[lc].insert({i,findo(ara[i][j-1],L[lc]+1)});
            query[lc].insert({i,findo(ara[i][j],L[lc]+1)});
            //if(i==1)cout<<lc<<" "<<ara[i][j-1]<<" "<<ara[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
       if(query[i].size()==0)continue;
    //  cout<<query[i].size()<<endl;
   // cout<<i<<endl;
       process(i);
   //    cout<<ans[3]<<endl;
       query[i].clear();
    }
  //  cout<<ans[3]<<endl;
    for(int i=1;i<=n;i++)
    {
       set<pii>::iterator it;
       for(it=mylist[i].begin();it!=mylist[i].end();it++)
       {
           chum[i].pb(*it);
       }
       sort(chum[i].begin(),chum[i].end());
    }
 //   cout<<ans[6]<<endl;
    for(int i=1;i<=n;i++){
    vector<tii>tmp;
       for(int j=0;j<ara[i].size();j++)
       {
          int c=ara[i][j];
          tmp.pb({{start[c],c},0});
       }
        for(int j=0;j<ara[i+1].size();j++)
       {
          int c=ara[i+1][j];
          tmp.pb({{start[c],c},1});
       }
       sort(tmp.rbegin(),tmp.rend());
       int toxic[2];
       toxic[0]=-1;
       toxic[1]=-1;
       for(int j=0;j<tmp.size();j++)
       {
          int c=tmp[j].fs.sc;
          int x=tmp[j].sc;
          if(toxic[x^1]!=-1)
          {
             int lca=lca_query(toxic[x^1],c);
             int f=findo(c,L[lca]+1);
             int g=findo(toxic[x^1],L[lca]+1);
             if(lca==c||lca==toxic[x^1]);
             else{
          //   cout<<lca<<" "<<g<<" "<<f<<" "<<c<<" "<<toxic[x^1]<<endl;
             int tar;
             tar=f;
             //else tar=g;
             int koyta=query_bin(tar,i-L[tar]+1);
              koyta+=query_bin(lca,i-L[lca]);
              if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);
                tar=g;
             //else tar=g;

              koyta=query_bin(tar,i-L[tar]+1);
            //  cout<<lca<<" "<<tar<<" "<<f<<" "<<g<<" "<<koyta<<" "<<endl;
              koyta+=query_bin(lca,i-L[lca]);
               if(len[tar]>=i-L[tar]+1)koyta--;
              if(parentanse[lca]>=i-L[lca])koyta++;
              ans[i+i-L[lca]*2]=max(ans[i+i-L[lca]*2],koyta);

              int ko=query_bin(lca,i+1-L[lca]);
              if(parentanse[lca]>=i+1-L[lca])ko++;
              if(lo_bo(lca,i-L[lca])||parentanse[lca]==i-L[lca]);
              else ko--;
              ans[i+1+i-2*L[lca]]=max(ans[i+1+i-2*L[lca]],ko+1);
          }
          }
          toxic[x]=c;

       }

    }
    for(int i=1;i<=n;i++)
    {
      ans[1]=max(ans[1],(int)vc[i].size()+1);
    }
    for(int i=1;i<=n;i++)
    {
      ans[i]=max(ans[i],1);
      if(i<=dia)ans[i]=max(ans[i],2);
      printf("%d ",ans[i]);
    }

}