#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

const int N_MAX = 5e5, magic = 300;
int n, down[N_MAX-1], up[N_MAX-1], sol[N_MAX+1];
bool seen[N_MAX];
pair<int, int> E[N_MAX-1];
vector<int> G[N_MAX];

int DFS1(int u) {
    int ans = 0;
    seen[u] = true;
    for (int e: G[u]) {
        if(seen[E[e].first] && seen[E[e].second]) continue;
        if(E[e].second == u) swap(E[e].first, E[e].second);
        down[e] = DFS1(E[e].second)+1;
        ans = max(ans, down[e]);
    }
    return ans;
}

void DFS2(int u) {
    int e1 = -1, e2 = -1, upp = 1;
    for (int e: G[u]) {
        if(E[e].second == u) {
            upp = up[e]+1;
            continue;
        }
        if(e1 == -1) e1 = e;
        else if(down[e] > down[e1]) {
            e2 = e1;
            e1 = e;
        }
        else if(e2 == -1 || down[e] > down[e2]) {
            e2 = e;
        }
    }
    for (int e: G[u]) {
        if(E[e].second == u) continue;
        up[e] = upp;
        if(e != e1 && down[e1]+1 > up[e]) up[e] = down[e1]+1;
        if(e == e1 && e2 != -1 && down[e2]+1 > up[e]) up[e] = down[e2]+1;
        DFS2(E[e].second);
    }
}

vector<int> s;
void solve_odd() {
    for (int v = 0; v < n; v++) {
        s.clear();
        for (int e: G[v]) {
            if(E[e].first == v) s.push_back(down[e]);
            else s.push_back(up[e]);
        }
        sort(s.begin(), s.end(), greater<int>());
        for (int i = 1; i < s.size(); i++) {
            int l = (s[i-1] > s[i] ? s[i]+1 : s[i]);
            sol[2*l-1] = max(sol[2*l-1], i+1);

            sol[2*s[i]] = max(sol[2*s[i]], i+1);
        }
    }
    sol[1] = 0;
    for (int v = 0; v < n; v++) sol[1] = max(sol[1], (int)G[v].size()+1);

    for (int k = (n%2 ? n-2 : n-3); 0 < k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);
}

int ok[N_MAX];
void solve(int k) { //k is even
    k /= 2;
    for (int v = 0; v < n; v++) {
        ok[v] = 0;
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= k) ok[v]++;
        }
    }
    for (int e = 0; e < n-1; e++) {
        if(ok[E[e].first] > 1 && ok[E[e].second] > 1)
            sol[2*k] = max(sol[2*k], ok[E[e].first]+ok[E[e].second]-2);
    }
}

vector<pair<int,int>> b[N_MAX];
void solve_big_even() {//2*(>= magic)
    for (int v = 0; v < n; v++) {
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= magic) b[v].push_back({x, e});
        }
        sort(b[v].begin(), b[v].end(), greater<pair<int,int>>());
    }
    for (int e = 0; e < n-1; e++) {
        if(b[E[e].first].size() < 2 || b[E[e].second].size() < 2) continue;
        s.clear();
        int u = E[e].first, v = E[e].second;
        int i1 = (b[u][0].second == e ? 1 : 0);
        int i2 = (b[v][0].second == e ? 1 : 0);
        while(i1 < b[u].size() || i2 < b[v].size()) {
            if(i2 == b[v].size() || (i1 < b[u].size() && b[u][i1].first > b[v][i2].first)) {
                s.push_back(b[u][i1].first);
                i1++;
                if(i1 < b[u].size() && b[u][i1].second == e) i1++;
            }
            else {
                s.push_back(b[v][i2].first);
                i2++;
                if(i2 < b[v].size() && b[v][i2].second == e) i2++;
            }
        }
        for (int i = 1; i < s.size(); i++)
            sol[2*s[i]] = max(sol[2*s[i]], i+1);
    }

    for (int k = (n%2 ? n-3 : n-2); 2*magic <= k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);

}

int main() {
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v; cin >> u >> v; u--; v--;
        E[i] = {u,v};
        G[u].push_back(i);
        G[v].push_back(i);
    }
    DFS1(0);
    DFS2(0);

    for (int k = 1; k <= n; k++) sol[k] = 1;
    solve_odd();
    for (int k = 2; k < 2*magic; k += 2) solve(k);
    solve_big_even();
    for (int k = 1; k <= n; k++) cout << sol[k] << " "; cout << endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

const int N_MAX = 5e5, magic = 0;
int n, down[N_MAX-1], up[N_MAX-1], sol[N_MAX+1];
bool seen[N_MAX];
pair<int, int> E[N_MAX-1];
vector<int> G[N_MAX];

int DFS1(int u) {
    int ans = 0;
    seen[u] = true;
    for (int e: G[u]) {
        if(seen[E[e].first] && seen[E[e].second]) continue;
        if(E[e].second == u) swap(E[e].first, E[e].second);
        down[e] = DFS1(E[e].second)+1;
        ans = max(ans, down[e]);
    }
    return ans;
}

void DFS2(int u) {
    int e1 = -1, e2 = -1, upp = 1;
    for (int e: G[u]) {
        if(E[e].second == u) {
            upp = up[e]+1;
            continue;
        }
        if(e1 == -1) e1 = e;
        else if(down[e] > down[e1]) {
            e2 = e1;
            e1 = e;
        }
        else if(e2 == -1 || down[e] > down[e2]) {
            e2 = e;
        }
    }
    for (int e: G[u]) {
        if(E[e].second == u) continue;
        up[e] = upp;
        if(e != e1 && down[e1]+1 > up[e]) up[e] = down[e1]+1;
        if(e == e1 && e2 != -1 && down[e2]+1 > up[e]) up[e] = down[e2]+1;
        DFS2(E[e].second);
    }
}

vector<int> s;
void solve_odd() {
    for (int v = 0; v < n; v++) {
        s.clear();
        for (int e: G[v]) {
            if(E[e].first == v) s.push_back(down[e]);
            else s.push_back(up[e]);
        }
        sort(s.begin(), s.end(), greater<int>());
        for (int i = 1; i < s.size(); i++) {
            int l = (s[i-1] > s[i] ? s[i]+1 : s[i]);
            sol[2*l-1] = max(sol[2*l-1], i+1);

            sol[2*s[i]] = max(sol[2*s[i]], i+1);
        }
    }
    sol[1] = 0;
    for (int v = 0; v < n; v++) sol[1] = max(sol[1], (int)G[v].size()+1);

    for (int k = (n%2 ? n-2 : n-3); 0 < k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);
}

int ok[N_MAX];
void solve(int k) { //k is even
    k /= 2;
    for (int v = 0; v < n; v++) {
        ok[v] = 0;
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= k) ok[v]++;
        }
    }
    for (int e = 0; e < n-1; e++) {
        if(ok[E[e].first] > 1 && ok[E[e].second] > 1)
            sol[2*k] = max(sol[2*k], ok[E[e].first]+ok[E[e].second]-2);
    }
}

vector<pair<int,int>> b[N_MAX];
void solve_big_even() {//2*(>= magic)
    for (int v = 0; v < n; v++) {
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= magic) b[v].push_back({x, e});
        }
        sort(b[v].begin(), b[v].end(), greater<pair<int,int>>());
    }
    for (int e = 0; e < n-1; e++) {
        if(b[E[e].first].size() < 2 || b[E[e].second].size() < 2) continue;
        s.clear();
        int u = E[e].first, v = E[e].second;
        int i1 = (b[u][0].second == e ? 1 : 0);
        int i2 = (b[v][0].second == e ? 1 : 0);
        while(i1 < b[u].size() || i2 < b[v].size()) {
            if(i2 == b[v].size() || (i1 < b[u].size() && b[u][i1].first > b[v][i2].first)) {
                s.push_back(b[u][i1].first);
                i1++;
                if(i1 < b[u].size() && b[u][i1].second == e) i1++;
            }
            else {
                s.push_back(b[v][i2].first);
                i2++;
                if(i2 < b[v].size() && b[v][i2].second == e) i2++;
            }
        }
        for (int i = 1; i < s.size(); i++)
            sol[2*s[i]] = max(sol[2*s[i]], i+1);
    }

    for (int k = (n%2 ? n-3 : n-2); 2*magic <= k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);

}

int main() {
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v; cin >> u >> v; u--; v--;
        E[i] = {u,v};
        G[u].push_back(i);
        G[v].push_back(i);
    }
    DFS1(0);
    DFS2(0);

    for (int k = 1; k <= n; k++) sol[k] = 1;
    solve_odd();
    for (int k = 2; k < 2*magic; k += 2) solve(k);
    solve_big_even();
    for (int k = 1; k <= n; k++) cout << sol[k] << " "; cout << endl;
    return 0;
}


//it should be TL
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

const int N_MAX = 5e5;
int n, down[N_MAX-1], up[N_MAX-1], sol[N_MAX+1];
bool seen[N_MAX];
pair<int, int> E[N_MAX-1];
vector<int> G[N_MAX];

int DFS1(int u) {
    int ans = 0;
    seen[u] = true;
    for (int e: G[u]) {
        if(seen[E[e].first] && seen[E[e].second]) continue;
        if(E[e].second == u) swap(E[e].first, E[e].second);
        down[e] = DFS1(E[e].second)+1;
        ans = max(ans, down[e]);
    }
    return ans;
}

void DFS2(int u) {
    int e1 = -1, e2 = -1, upp = 1;
    for (int e: G[u]) {
        if(E[e].second == u) {
            upp = up[e]+1;
            continue;
        }
        if(e1 == -1) e1 = e;
        else if(down[e] > down[e1]) {
            e2 = e1;
            e1 = e;
        }
        else if(e2 == -1 || down[e] > down[e2]) {
            e2 = e;
        }
    }
    for (int e: G[u]) {
        if(E[e].second == u) continue;
        up[e] = upp;
        if(e != e1 && down[e1]+1 > up[e]) up[e] = down[e1]+1;
        if(e == e1 && e2 != -1 && down[e2]+1 > up[e]) up[e] = down[e2]+1;
        DFS2(E[e].second);
    }
}

vector<int> s;
void solve_odd() {
    for (int v = 0; v < n; v++) {
        s.clear();
        for (int e: G[v]) {
            if(E[e].first == v) s.push_back(down[e]);
            else s.push_back(up[e]);
        }
        sort(s.begin(), s.end(), greater<int>());
        for (int i = 1; i < s.size(); i++) {
            int l = (s[i-1] > s[i] ? s[i]+1 : s[i]);
            sol[2*l-1] = max(sol[2*l-1], i+1);

            sol[2*s[i]] = max(sol[2*s[i]], i+1);
        }
    }
    sol[1] = 0;
    for (int v = 0; v < n; v++) sol[1] = max(sol[1], (int)G[v].size()+1);
}

int ok[N_MAX];
void solve(int k) { //k is even
    k /= 2;
    for (int v = 0; v < n; v++) {
        ok[v] = 0;
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= k) ok[v]++;
        }
    }
    for (int e = 0; e < n-1; e++) {
        if(ok[E[e].first] > 1 && ok[E[e].second] > 1)
            sol[2*k] = max(sol[2*k], ok[E[e].first]+ok[E[e].second]-2);
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v; cin >> u >> v; u--; v--;
        E[i] = {u,v};
        G[u].push_back(i);
        G[v].push_back(i);
    }
    DFS1(0);
    DFS2(0);

    for (int k = 1; k <= n; k++) sol[k] = 1;
    solve_odd();
    for (int k = (n%2 ? n-2 : n-3); 0 < k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);
    for (int k = 2; k <= n; k += 2) solve(k);
    for (int k = 1; k <= n; k++) cout << sol[k] << " "; cout << endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

const int N_MAX = 5e5;
int n, p[N_MAX], down[N_MAX], up[N_MAX], ans[2*N_MAX+1];
vector<int> G[N_MAX], children[N_MAX];

void DFS(int u) {
    for (int v: G[u]) {
        if(v == p[u]) continue;
        p[v] = u;
        DFS(v);
        down[u] = max(down[u], down[v]+1);
    }
}

void DFS2(int u) {
    if(children[u].empty()) return;
    int maxi = 0;
    for (int i = 1; i < children[u].size(); i++) {
        if(down[children[u][i]] > down[children[u][maxi]]) maxi = i;
    }
    for (int i = 0; i < children[u].size(); i++) {
        if(i != maxi) up[children[u][i]] = down[children[u][maxi]]+2;
        else {
            int mx = -2;
            for (int j = 0; j < children[u].size(); j++) {
                if(j != maxi) mx = max(mx, down[children[u][j]]);
            }
            up[children[u][i]] = mx+2;
        }
        up[children[u][i]] = max(up[children[u][i]], up[u]+1);
    }
    for (int v: children[u]) DFS2(v);
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    //k == 1
    int sol = 0;
    for (int i = 0; i < n; i++) sol = max(sol, (int)G[i].size());
    cout << sol+1 << " ";

    //k==2
    for (int i = 0; i < n; i++)
        for (int j: G[i]) sol = max(sol, (int)G[i].size()+(int)G[j].size()-2);
    cout << sol << (n == 2 ? "\n" : " ");
    if(n == 2) return 0;
    p[0] = -1;
    DFS(0);

    for (int i = 0; i < n; i++) {
        for (int j : G[i]) if(j != p[i]) children[i].push_back(j);
    }
    DFS2(0);
    for (int k = 1; k <= n; k++) ans[k] = 1;
    for (int i = 0; i < n; i++) {
        vector<int> v;
        if(up[i]) v.push_back(up[i]);
        for (int j: children[i]) v.push_back(down[j]+1);

        sort(v.begin(), v.end(), greater<int>());
        for (int l = 1; l < v.size(); l++) {
            if(v[0] == v[l]) ans[2*v[l]-1] = max(ans[2*v[l]-1], l+1);
            else {
                ans[2*v[l]] = max(ans[2*v[l]], l+1);
                if(v[l] < v[l-1]) ans[2*v[l]+1] = max(ans[2*v[l]+1], l+1);
            }
        }
    }
    for (int k = n-1; 3 <= k; k--) ans[k] = max(ans[k], ans[k+1]);
    for (int k = 3; k <= n; k++) cout << ans[k] << " "; cout << "\n";

    return 0;
}


#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

const int N_MAX = 5e5, magic = 1e3;
int n, down[N_MAX-1], up[N_MAX-1], sol[N_MAX+1];
bool seen[N_MAX];
pair<int, int> E[N_MAX-1];
vector<int> G[N_MAX];

int DFS1(int u) {
    int ans = 0;
    seen[u] = true;
    for (int e: G[u]) {
        if(seen[E[e].first] && seen[E[e].second]) continue;
        if(E[e].second == u) swap(E[e].first, E[e].second);
        down[e] = DFS1(E[e].second)+1;
        ans = max(ans, down[e]);
    }
    return ans;
}

void DFS2(int u) {
    int e1 = -1, e2 = -1, upp = 1;
    for (int e: G[u]) {
        if(E[e].second == u) {
            upp = up[e]+1;
            continue;
        }
        if(e1 == -1) e1 = e;
        else if(down[e] > down[e1]) {
            e2 = e1;
            e1 = e;
        }
        else if(e2 == -1 || down[e] > down[e2]) {
            e2 = e;
        }
    }
    for (int e: G[u]) {
        if(E[e].second == u) continue;
        up[e] = upp;
        if(e != e1 && down[e1]+1 > up[e]) up[e] = down[e1]+1;
        if(e == e1 && e2 != -1 && down[e2]+1 > up[e]) up[e] = down[e2]+1;
        DFS2(E[e].second);
    }
}

vector<int> s;
void solve_odd() {
    for (int v = 0; v < n; v++) {
        s.clear();
        for (int e: G[v]) {
            if(E[e].first == v) s.push_back(down[e]);
            else s.push_back(up[e]);
        }
        sort(s.begin(), s.end(), greater<int>());
        for (int i = 1; i < s.size(); i++) {
            int l = (s[i-1] > s[i] ? s[i]+1 : s[i]);
            sol[2*l-1] = max(sol[2*l-1], i+1);

            sol[2*s[i]] = max(sol[2*s[i]], i+1);
        }
    }
    sol[1] = 0;
    for (int v = 0; v < n; v++) sol[1] = max(sol[1], (int)G[v].size()+1);

    for (int k = (n%2 ? n-2 : n-3); 0 < k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);
}

int ok[N_MAX];
void solve(int k) { //k is even
    k /= 2;
    for (int v = 0; v < n; v++) {
        ok[v] = 0;
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= k) ok[v]++;
        }
    }
    for (int e = 0; e < n-1; e++) {
        if(ok[E[e].first] > 1 && ok[E[e].second] > 1)
            sol[2*k] = max(sol[2*k], ok[E[e].first]+ok[E[e].second]-2);
    }
}

vector<pair<int,int>> b[N_MAX];
void solve_big_even() {//2*(>= magic)
    for (int v = 0; v < n; v++) {
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= magic) b[v].push_back({x, e});
        }
        sort(b[v].begin(), b[v].end(), greater<pair<int,int>>());
    }
    for (int e = 0; e < n-1; e++) {
        if(b[E[e].first].size() < 2 || b[E[e].second].size() < 2) continue;
        s.clear();
        int u = E[e].first, v = E[e].second;
        int i1 = (b[u][0].second == e ? 1 : 0);
        int i2 = (b[v][0].second == e ? 1 : 0);
        while(i1 < b[u].size() || i2 < b[v].size()) {
            if(i2 == b[v].size() || b[u][i1].first > b[v][i2].first) {
                s.push_back(b[u][i1].first);
                i1++;
                if(i1 < b[u].size() && b[u][i1].second == e) i1++;
            }
            else {
                s.push_back(b[v][i2].first);
                i2++;
                if(i2 < b[v].size() && b[v][i2].second == e) i2++;
            }
        }
        for (int i = 1; i < s.size(); i++)
            sol[2*s[i]] = max(sol[2*s[i]], i+1);
    }

    for (int k = (n%2 ? n-3 : n-2); 2*magic <= k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);

}

int main() {
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v; cin >> u >> v; u--; v--;
        E[i] = {u,v};
        G[u].push_back(i);
        G[v].push_back(i);
    }
    DFS1(0);
    DFS2(0);

    for (int k = 1; k <= n; k++) sol[k] = 1;
    solve_odd();
    for (int k = 2; k < 2*magic; k += 2) solve(k);
    solve_big_even();
    for (int k = 1; k <= n; k++) cout << sol[k] << " "; cout << endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

const int N_MAX = 5e5;
int n, p[N_MAX], down[N_MAX], up[N_MAX], ans[2*N_MAX+1];
vector<int> G[N_MAX], children[N_MAX];

void DFS(int u) {
    for (int v: G[u]) {
        if(v == p[u]) continue;
        p[v] = u;
        DFS(v);
        down[u] = max(down[u], down[v]+1);
    }
}

void DFS2(int u) {
    if(children[u].empty()) return;
    int maxi = 0;
    for (int i = 1; i < children[u].size(); i++) {
        if(down[children[u][i]] > down[children[u][maxi]]) maxi = i;
    }
    for (int i = 0; i < children[u].size(); i++) {
        if(i != maxi) up[children[u][i]] = down[children[u][maxi]]+2;
        else {
            int mx = 0;
            for (int j = 0; j < children[u].size(); j++) {
                if(j != maxi) mx = max(mx, down[children[u][j]]);
            }
            up[children[u][i]] = mx+2;
        }
        up[children[u][i]] = max(up[children[u][i]], up[u]+1);
    }
    for (int v: children[u]) DFS2(v);
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    //k == 1
    int sol = 0;
    for (int i = 0; i < n; i++) sol = max(sol, (int)G[i].size());
    cout << sol+1 << " ";

    //k==2
    for (int i = 0; i < n; i++)
        for (int j: G[i]) sol = max(sol, (int)G[i].size()+(int)G[j].size()-2);
    cout << sol << (n == 2 ? "\n" : " ");
    if(n == 2) return 0;
    p[0] = -1;
    DFS(0);

    for (int i = 0; i < n; i++) {
        for (int j : G[i]) if(j != p[i]) children[i].push_back(j);
    }
    DFS2(0);

    for (int k = 1; k <= n; k++) ans[k] = 1;
    for (int i = 0; i < n; i++) {
        vector<int> v;
        if(up[i]) v.push_back(up[i]);
        for (int j: children[i]) v.push_back(down[j]+1);
        sort(v.begin(), v.end(), greater<int>());
        for (int l = 1; l < v.size(); l++) {
            if(v[0] == v[l]) ans[2*v[l]-1] = max(ans[2*v[l]-1], l+1);
            else {
                ans[2*v[l]] = max(ans[2*v[l]], l+1);
                if(v[l] != v[l-1]) ans[2*v[l]+1] = max(ans[2*v[l]+1], l+1);
            }
        }
    }
    for (int k = n-1; 3 <= k; k--) ans[k] = max(ans[k], ans[k+1]);
    for (int k = 3; k <= n; k++) cout << ans[k] << " "; cout << "\n";

    return 0;
}


#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

const int N_MAX = 5e5, magic = 40;
int n, down[N_MAX-1], up[N_MAX-1], sol[N_MAX+1];
bool seen[N_MAX];
pair<int, int> E[N_MAX-1];
vector<int> G[N_MAX];

int DFS1(int u) {
    int ans = 0;
    seen[u] = true;
    for (int e: G[u]) {
        if(seen[E[e].first] && seen[E[e].second]) continue;
        if(E[e].second == u) swap(E[e].first, E[e].second);
        down[e] = DFS1(E[e].second)+1;
        ans = max(ans, down[e]);
    }
    return ans;
}

void DFS2(int u) {
    int e1 = -1, e2 = -1, upp = 1;
    for (int e: G[u]) {
        if(E[e].second == u) {
            upp = up[e]+1;
            continue;
        }
        if(e1 == -1) e1 = e;
        else if(down[e] > down[e1]) {
            e2 = e1;
            e1 = e;
        }
        else if(e2 == -1 || down[e] > down[e2]) {
            e2 = e;
        }
    }
    for (int e: G[u]) {
        if(E[e].second == u) continue;
        up[e] = upp;
        if(e != e1 && down[e1]+1 > up[e]) up[e] = down[e1]+1;
        if(e == e1 && e2 != -1 && down[e2]+1 > up[e]) up[e] = down[e2]+1;
        DFS2(E[e].second);
    }
}

vector<int> s;
void solve_odd() {
    for (int v = 0; v < n; v++) {
        s.clear();
        for (int e: G[v]) {
            if(E[e].first == v) s.push_back(down[e]);
            else s.push_back(up[e]);
        }
        sort(s.begin(), s.end(), greater<int>());
        for (int i = 1; i < s.size(); i++) {
            int l = (s[i-1] > s[i] ? s[i]+1 : s[i]);
            sol[2*l-1] = max(sol[2*l-1], i+1);

            sol[2*s[i]] = max(sol[2*s[i]], i+1);
        }
    }
    sol[1] = 0;
    for (int v = 0; v < n; v++) sol[1] = max(sol[1], (int)G[v].size()+1);

    for (int k = (n%2 ? n-2 : n-3); 0 < k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);
}

int ok[N_MAX];
void solve(int k) { //k is even
    k /= 2;
    for (int v = 0; v < n; v++) {
        ok[v] = 0;
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= k) ok[v]++;
        }
    }
    for (int e = 0; e < n-1; e++) {
        if(ok[E[e].first] > 1 && ok[E[e].second] > 1)
            sol[2*k] = max(sol[2*k], ok[E[e].first]+ok[E[e].second]-2);
    }
}

vector<pair<int,int>> b[N_MAX];
void solve_big_even() {//2*(>= magic)
    for (int v = 0; v < n; v++) {
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= magic) b[v].push_back({x, e});
        }
        sort(b[v].begin(), b[v].end(), greater<pair<int,int>>());
    }
    for (int e = 0; e < n-1; e++) {
        if(b[E[e].first].size() < 2 || b[E[e].second].size() < 2) continue;
        s.clear();
        int u = E[e].first, v = E[e].second;
        int i1 = (b[u][0].second == e ? 1 : 0);
        int i2 = (b[v][0].second == e ? 1 : 0);
        while(i1 < b[u].size() || i2 < b[v].size()) {
            if(i2 == b[v].size() || (i1 < b[u].size() && b[u][i1].first > b[v][i2].first)) {
                s.push_back(b[u][i1].first);
                i1++;
                if(i1 < b[u].size() && b[u][i1].second == e) i1++;
            }
            else {
                s.push_back(b[v][i2].first);
                i2++;
                if(i2 < b[v].size() && b[v][i2].second == e) i2++;
            }
        }
        for (int i = 1; i < s.size(); i++)
            sol[2*s[i]] = max(sol[2*s[i]], i+1);
    }

    for (int k = (n%2 ? n-3 : n-2); 2*magic <= k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);

}

int main() {
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v; cin >> u >> v; u--; v--;
        E[i] = {u,v};
        G[u].push_back(i);
        G[v].push_back(i);
    }
    DFS1(0);
    DFS2(0);

    for (int k = 1; k <= n; k++) sol[k] = 1;
    solve_odd();
    for (int k = 2; k < 2*magic; k += 2) solve(k);
    solve_big_even();
    for (int k = 1; k <= n; k++) cout << sol[k] << " "; cout << endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

const int N_MAX = 5e5, magic = 0;
int n, down[N_MAX-1], up[N_MAX-1], sol[N_MAX+1];
bool seen[N_MAX];
pair<int, int> E[N_MAX-1];
vector<int> G[N_MAX];

int DFS1(int u) {
    int ans = 0;
    seen[u] = true;
    for (int e: G[u]) {
        if(seen[E[e].first] && seen[E[e].second]) continue;
        if(E[e].second == u) swap(E[e].first, E[e].second);
        down[e] = DFS1(E[e].second)+1;
        ans = max(ans, down[e]);
    }
    return ans;
}

void DFS2(int u) {
    int e1 = -1, e2 = -1, upp = 1;
    for (int e: G[u]) {
        if(E[e].second == u) {
            upp = up[e]+1;
            continue;
        }
        if(e1 == -1) e1 = e;
        else if(down[e] > down[e1]) {
            e2 = e1;
            e1 = e;
        }
        else if(e2 == -1 || down[e] > down[e2]) {
            e2 = e;
        }
    }
    for (int e: G[u]) {
        if(E[e].second == u) continue;
        up[e] = upp;
        if(e != e1 && down[e1]+1 > up[e]) up[e] = down[e1]+1;
        if(e == e1 && e2 != -1 && down[e2]+1 > up[e]) up[e] = down[e2]+1;
        DFS2(E[e].second);
    }
}

vector<int> s;
void solve_odd() {
    for (int v = 0; v < n; v++) {
        s.clear();
        for (int e: G[v]) {
            if(E[e].first == v) s.push_back(down[e]);
            else s.push_back(up[e]);
        }
        sort(s.begin(), s.end(), greater<int>());
        for (int i = 1; i < s.size(); i++) {
            int l = (s[i-1] > s[i] ? s[i]+1 : s[i]);
            sol[2*l-1] = max(sol[2*l-1], i+1);

            sol[2*s[i]] = max(sol[2*s[i]], i+1);
        }
    }
    sol[1] = 0;
    for (int v = 0; v < n; v++) sol[1] = max(sol[1], (int)G[v].size()+1);

    for (int k = (n%2 ? n-2 : n-3); 0 < k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);
}

int ok[N_MAX];
void solve(int k) { //k is even
    k /= 2;
    for (int v = 0; v < n; v++) {
        ok[v] = 0;
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= k) ok[v]++;
        }
    }
    for (int e = 0; e < n-1; e++) {
        if(ok[E[e].first] > 1 && ok[E[e].second] > 1)
            sol[2*k] = max(sol[2*k], ok[E[e].first]+ok[E[e].second]-2);
    }
}

vector<pair<int,int>> b[N_MAX];
void solve_big_even() {//2*(>= magic)
    for (int v = 0; v < n; v++) {
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= magic) b[v].push_back({x, e});
        }
        sort(b[v].begin(), b[v].end(), greater<pair<int,int>>());
    }
    for (int e = 0; e < n-1; e++) {
        if(b[E[e].first].size() < 2 || b[E[e].second].size() < 2) continue;
        s.clear();
        int u = E[e].first, v = E[e].second;
        int i1 = (b[u][0].second == e ? 1 : 0);
        int i2 = (b[v][0].second == e ? 1 : 0);
        while(i1 < b[u].size() || i2 < b[v].size()) {
            if(i2 == b[v].size() || b[u][i1].first > b[v][i2].first) {
                s.push_back(b[u][i1].first);
                i1++;
                if(i1 < b[u].size() && b[u][i1].second == e) i1++;
            }
            else {
                s.push_back(b[v][i2].first);
                i2++;
                if(i2 < b[v].size() && b[v][i2].second == e) i2++;
            }
        }
        for (int i = 1; i < s.size(); i++)
            sol[2*s[i]] = max(sol[2*s[i]], i+1);
    }

    for (int k = (n%2 ? n-3 : n-2); 2*magic <= k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);

}

int main() {
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v; cin >> u >> v; u--; v--;
        E[i] = {u,v};
        G[u].push_back(i);
        G[v].push_back(i);
    }
    DFS1(0);
    DFS2(0);

    for (int k = 1; k <= n; k++) sol[k] = 1;
    solve_odd();
    for (int k = 2; k < 2*magic; k += 2) solve(k);
    solve_big_even();
    for (int k = 1; k <= n; k++) cout << sol[k] << " "; cout << endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

const int N_MAX = 5e5, magic = 4e3;
int n, down[N_MAX-1], up[N_MAX-1], sol[N_MAX+1];
bool seen[N_MAX];
pair<int, int> E[N_MAX-1];
vector<int> G[N_MAX];

int DFS1(int u) {
    int ans = 0;
    seen[u] = true;
    for (int e: G[u]) {
        if(seen[E[e].first] && seen[E[e].second]) continue;
        if(E[e].second == u) swap(E[e].first, E[e].second);
        down[e] = DFS1(E[e].second)+1;
        ans = max(ans, down[e]);
    }
    return ans;
}

void DFS2(int u) {
    int e1 = -1, e2 = -1, upp = 1;
    for (int e: G[u]) {
        if(E[e].second == u) {
            upp = up[e]+1;
            continue;
        }
        if(e1 == -1) e1 = e;
        else if(down[e] > down[e1]) {
            e2 = e1;
            e1 = e;
        }
        else if(e2 == -1 || down[e] > down[e2]) {
            e2 = e;
        }
    }
    for (int e: G[u]) {
        if(E[e].second == u) continue;
        up[e] = upp;
        if(e != e1 && down[e1]+1 > up[e]) up[e] = down[e1]+1;
        if(e == e1 && e2 != -1 && down[e2]+1 > up[e]) up[e] = down[e2]+1;
        DFS2(E[e].second);
    }
}

vector<int> s;
void solve_odd() {
    for (int v = 0; v < n; v++) {
        s.clear();
        for (int e: G[v]) {
            if(E[e].first == v) s.push_back(down[e]);
            else s.push_back(up[e]);
        }
        sort(s.begin(), s.end(), greater<int>());
        for (int i = 1; i < s.size(); i++) {
            int l = (s[i-1] > s[i] ? s[i]+1 : s[i]);
            sol[2*l-1] = max(sol[2*l-1], i+1);

            sol[2*s[i]] = max(sol[2*s[i]], i+1);
        }
    }
    sol[1] = 0;
    for (int v = 0; v < n; v++) sol[1] = max(sol[1], (int)G[v].size()+1);

    for (int k = (n%2 ? n-2 : n-3); 0 < k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);
}

int ok[N_MAX];
void solve(int k) { //k is even
    k /= 2;
    for (int v = 0; v < n; v++) {
        ok[v] = 0;
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= k) ok[v]++;
        }
    }
    for (int e = 0; e < n-1; e++) {
        if(ok[E[e].first] > 1 && ok[E[e].second] > 1)
            sol[2*k] = max(sol[2*k], ok[E[e].first]+ok[E[e].second]-2);
    }
}

vector<pair<int,int>> b[N_MAX];
void solve_big_even() {//2*(>= magic)
    for (int v = 0; v < n; v++) {
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= magic) b[v].push_back({x, e});
        }
        sort(b[v].begin(), b[v].end(), greater<pair<int,int>>());
    }
    for (int e = 0; e < n-1; e++) {
        if(b[E[e].first].size() < 2 || b[E[e].second].size() < 2) continue;
        s.clear();
        int u = E[e].first, v = E[e].second;
        int i1 = (b[u][0].second == e ? 1 : 0);
        int i2 = (b[v][0].second == e ? 1 : 0);
        while(i1 < b[u].size() || i2 < b[v].size()) {
            if(i2 == b[v].size() || b[u][i1].first > b[v][i2].first) {
                s.push_back(b[u][i1].first);
                i1++;
                if(i1 < b[u].size() && b[u][i1].second == e) i1++;
            }
            else {
                s.push_back(b[v][i2].first);
                i2++;
                if(i2 < b[v].size() && b[v][i2].second == e) i2++;
            }
        }
        for (int i = 1; i < s.size(); i++)
            sol[2*s[i]] = max(sol[2*s[i]], i+1);
    }

    for (int k = (n%2 ? n-3 : n-2); 2*magic <= k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);

}

int main() {
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v; cin >> u >> v; u--; v--;
        E[i] = {u,v};
        G[u].push_back(i);
        G[v].push_back(i);
    }
    DFS1(0);
    DFS2(0);

    for (int k = 1; k <= n; k++) sol[k] = 1;
    solve_odd();
    for (int k = 2; k < 2*magic; k += 2) solve(k);
    solve_big_even();
    for (int k = 1; k <= n; k++) cout << sol[k] << " "; cout << endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

const int N_MAX = 5e5, magic = 1e3;
int n, down[N_MAX-1], up[N_MAX-1], sol[N_MAX+1];
bool seen[N_MAX];
pair<int, int> E[N_MAX-1];
vector<int> G[N_MAX];

int DFS1(int u) {
    int ans = 0;
    seen[u] = true;
    for (int e: G[u]) {
        if(seen[E[e].first] && seen[E[e].second]) continue;
        if(E[e].second == u) swap(E[e].first, E[e].second);
        down[e] = DFS1(E[e].second)+1;
        ans = max(ans, down[e]);
    }
    return ans;
}

void DFS2(int u) {
    int e1 = -1, e2 = -1, upp = 1;
    for (int e: G[u]) {
        if(E[e].second == u) {
            upp = up[e]+1;
            continue;
        }
        if(e1 == -1) e1 = e;
        else if(down[e] > down[e1]) {
            e2 = e1;
            e1 = e;
        }
        else if(e2 == -1 || down[e] > down[e2]) {
            e2 = e;
        }
    }
    for (int e: G[u]) {
        if(E[e].second == u) continue;
        up[e] = upp;
        if(e != e1 && down[e1]+1 > up[e]) up[e] = down[e1]+1;
        if(e == e1 && e2 != -1 && down[e2]+1 > up[e]) up[e] = down[e2]+1;
        DFS2(E[e].second);
    }
}

vector<int> s;
void solve_odd() {
    for (int v = 0; v < n; v++) {
        s.clear();
        for (int e: G[v]) {
            if(E[e].first == v) s.push_back(down[e]);
            else s.push_back(up[e]);
        }
        sort(s.begin(), s.end(), greater<int>());
        for (int i = 1; i < s.size(); i++) {
            int l = (s[i-1] > s[i] ? s[i]+1 : s[i]);
            sol[2*l-1] = max(sol[2*l-1], i+1);

            sol[2*s[i]] = max(sol[2*s[i]], i+1);
        }
    }
    sol[1] = 0;
    for (int v = 0; v < n; v++) sol[1] = max(sol[1], (int)G[v].size()+1);

    for (int k = (n%2 ? n-2 : n-3); 0 < k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);
}

int ok[N_MAX];
void solve(int k) { //k is even
    k /= 2;
    for (int v = 0; v < n; v++) {
        ok[v] = 0;
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= k) ok[v]++;
        }
    }
    for (int e = 0; e < n-1; e++) {
        if(ok[E[e].first] > 1 && ok[E[e].second] > 1)
            sol[2*k] = max(sol[2*k], ok[E[e].first]+ok[E[e].second]-2);
    }
}

vector<pair<int,int>> b[N_MAX];
void solve_big_even() {//2*(>= magic)
    for (int v = 0; v < n; v++) {
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= magic) b[v].push_back({x, e});
        }
        sort(b[v].begin(), b[v].end(), greater<pair<int,int>>());
    }
    for (int e = 0; e < n-1; e++) {
        if(b[E[e].first].size() < 2 || b[E[e].second].size() < 2) continue;
        s.clear();
        int u = E[e].first, v = E[e].second;
        int i1 = (b[u][0].second == e ? 1 : 0);
        int i2 = (b[v][0].second == e ? 1 : 0);
        while(i1 < b[u].size() || i2 < b[v].size()) {
            if(i2 == b[v].size() || (i1 < b[u].size() && b[u][i1].first > b[v][i2].first)) {
                s.push_back(b[u][i1].first);
                i1++;
                if(i1 < b[u].size() && b[u][i1].second == e) i1++;
            }
            else {
                s.push_back(b[v][i2].first);
                i2++;
                if(i2 < b[v].size() && b[v][i2].second == e) i2++;
            }
        }
        for (int i = 1; i < s.size(); i++)
            sol[2*s[i]] = max(sol[2*s[i]], i+1);
    }

    for (int k = (n%2 ? n-3 : n-2); 2*magic <= k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);

}

int main() {
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v; cin >> u >> v; u--; v--;
        E[i] = {u,v};
        G[u].push_back(i);
        G[v].push_back(i);
    }
    DFS1(0);
    DFS2(0);

    for (int k = 1; k <= n; k++) sol[k] = 1;
    solve_odd();
    for (int k = 2; k < 2*magic; k += 2) solve(k);
    solve_big_even();
    for (int k = 1; k <= n; k++) cout << sol[k] << " "; cout << endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

const int N_MAX = 5e5, magic = 100;
int n, down[N_MAX-1], up[N_MAX-1], sol[N_MAX+1];
bool seen[N_MAX];
pair<int, int> E[N_MAX-1];
vector<int> G[N_MAX];

int DFS1(int u) {
    int ans = 0;
    seen[u] = true;
    for (int e: G[u]) {
        if(seen[E[e].first] && seen[E[e].second]) continue;
        if(E[e].second == u) swap(E[e].first, E[e].second);
        down[e] = DFS1(E[e].second)+1;
        ans = max(ans, down[e]);
    }
    return ans;
}

void DFS2(int u) {
    int e1 = -1, e2 = -1, upp = 1;
    for (int e: G[u]) {
        if(E[e].second == u) {
            upp = up[e]+1;
            continue;
        }
        if(e1 == -1) e1 = e;
        else if(down[e] > down[e1]) {
            e2 = e1;
            e1 = e;
        }
        else if(e2 == -1 || down[e] > down[e2]) {
            e2 = e;
        }
    }
    for (int e: G[u]) {
        if(E[e].second == u) continue;
        up[e] = upp;
        if(e != e1 && down[e1]+1 > up[e]) up[e] = down[e1]+1;
        if(e == e1 && e2 != -1 && down[e2]+1 > up[e]) up[e] = down[e2]+1;
        DFS2(E[e].second);
    }
}

vector<int> s;
void solve_odd() {
    for (int v = 0; v < n; v++) {
        s.clear();
        for (int e: G[v]) {
            if(E[e].first == v) s.push_back(down[e]);
            else s.push_back(up[e]);
        }
        sort(s.begin(), s.end(), greater<int>());
        for (int i = 1; i < s.size(); i++) {
            int l = (s[i-1] > s[i] ? s[i]+1 : s[i]);
            sol[2*l-1] = max(sol[2*l-1], i+1);

            sol[2*s[i]] = max(sol[2*s[i]], i+1);
        }
    }
    sol[1] = 0;
    for (int v = 0; v < n; v++) sol[1] = max(sol[1], (int)G[v].size()+1);

    for (int k = (n%2 ? n-2 : n-3); 0 < k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);
}

int ok[N_MAX];
void solve(int k) { //k is even
    k /= 2;
    for (int v = 0; v < n; v++) {
        ok[v] = 0;
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= k) ok[v]++;
        }
    }
    for (int e = 0; e < n-1; e++) {
        if(ok[E[e].first] > 1 && ok[E[e].second] > 1)
            sol[2*k] = max(sol[2*k], ok[E[e].first]+ok[E[e].second]-2);
    }
}

vector<pair<int,int>> b[N_MAX];
void solve_big_even() {//2*(>= magic)
    for (int v = 0; v < n; v++) {
        for (int e: G[v]) {
            int x = (E[e].first == v ? down[e] : up[e]);
            if(x >= magic) b[v].push_back({x, e});
        }
        sort(b[v].begin(), b[v].end(), greater<pair<int,int>>());
    }
    for (int e = 0; e < n-1; e++) {
        if(b[E[e].first].size() < 2 || b[E[e].second].size() < 2) continue;
        s.clear();
        int u = E[e].first, v = E[e].second;
        int i1 = (b[u][0].second == e ? 1 : 0);
        int i2 = (b[v][0].second == e ? 1 : 0);
        while(i1 < b[u].size() || i2 < b[v].size()) {
            if(i2 == b[v].size() || (i1 < b[u].size() && b[u][i1].first > b[v][i2].first)) {
                s.push_back(b[u][i1].first);
                i1++;
                if(i1 < b[u].size() && b[u][i1].second == e) i1++;
            }
            else {
                s.push_back(b[v][i2].first);
                i2++;
                if(i2 < b[v].size() && b[v][i2].second == e) i2++;
            }
        }
        for (int i = 1; i < s.size(); i++)
            sol[2*s[i]] = max(sol[2*s[i]], i+1);
    }

    for (int k = (n%2 ? n-3 : n-2); 2*magic <= k; k -= 2)
        sol[k] = max(sol[k], sol[k+2]);

}

int main() {
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        int u, v; cin >> u >> v; u--; v--;
        E[i] = {u,v};
        G[u].push_back(i);
        G[v].push_back(i);
    }
    DFS1(0);
    DFS2(0);

    for (int k = 1; k <= n; k++) sol[k] = 1;
    solve_odd();
    for (int k = 2; k < 2*magic; k += 2) solve(k);
    solve_big_even();
    for (int k = 1; k <= n; k++) cout << sol[k] << " "; cout << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
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 SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#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 T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
///// This part below is only for debug, not used /////
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 deque<T> &vec){ os << "deq["; 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; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
///// END /////

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

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

vector<map<int, 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][lgtail[nxt] + 1]++;
    if (prv >= 0)
    {
        uptail[now] = max(uptail[prv], len) + 1;
        tails[now][uptail[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);
    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 nb = 0;
        for (auto p : tails[i])  nb += p.second;
        for (auto p : tails[i]) {
            if (p.second > 1 and p.first > 1)
            {
                mmax(ret[p.first * 2 - 1], nb);
            }
            mmax(ret[p.first * 2 + 1], nb - p.second + 1);
            mmax(ret[p.first * 2], nb);
            mmax(ret[p.first], 2);
            nb -= p.second;
        }
    }

    // dbg(tails);

    FOR(c, 1, N) {
        int p = par[c];
        map<int, int> ma = tails[p];
        for (auto p : tails[c]) ma[p.first] += p.second;
        ma[lgtail[c] + 1]--;
        ma[uptail[c]]--;
        // dbg(c);
        // dbg(ma);
        int nb = 0;
        for (auto p : ma) nb += p.second;
        for (auto p : ma) if (p.second) {
            mmax(ret[p.first * 2], nb);
            nb -= p.second;
        }
    }

    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;
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;
    }
    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);
    }
    if (prv >= 0)
    {
        tails[now].push_back(uptail[now]);
    }
    sort(ALL(tails[now]));
}

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);
    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);
        }
        REP(j, d) mmax(ret[tails[i][j] * 2], 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;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
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 SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#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 T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
///// This part below is only for debug, not used /////
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 deque<T> &vec){ os << "deq["; 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; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
///// END /////

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

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

vector<map<int, 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][lgtail[nxt] + 1]++;
    if (prv >= 0)
    {
        uptail[now] = max(uptail[prv], len) + 1;
        tails[now][uptail[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);
    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 nb = 0;
        for (auto p : tails[i])  nb += p.second;
        for (auto p : tails[i]) {
            if (p.second > 1 and p.first > 1)
            {
                mmax(ret[p.first * 2 - 1], nb);
            }
            mmax(ret[p.first * 2 + 1], nb - p.second + 1);
            mmax(ret[p.first * 2], nb);
            mmax(ret[p.first], 2);
            nb -= p.second;
        }
    }

    // dbg(tails);

    FOR(c, 1, N) {
        int p = par[c];
        if (tails[p].size() <= 1 or tails[c].size() <= 1) continue;
        map<int, int> ma = tails[p];
        for (auto p : tails[c]) ma[p.first] += p.second;
        ma[lgtail[c] + 1]--;
        ma[uptail[c]]--;
        // dbg(c);
        // dbg(ma);
        int nb = 0;
        for (auto p : ma) nb += p.second;
        for (auto p : ma) if (p.second) {
            mmax(ret[p.first * 2], nb);
            nb -= p.second;
        }
    }

    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;
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)
{
    int i_1 = -1, i_2 = -1;
    for (auto nxt : e[now]) if (nxt != prv)
    {
        if (i_1 < 0) i_1 = nxt;
        else if (lgtail[nxt] >= lgtail[i_1])
        {
            i_2 = i_1;
            i_1 = nxt;
        }
        tails[now].push_back(lgtail[nxt] + 1);
    }
    if (prv >= 0) uptail[now] = max(uptail[prv], len) + 1;

    for (auto nxt : e[now]) if (nxt != prv)
    {
        dfs_uptail(nxt, now, (nxt == i_1 ? (i_2 > 0 ? lgtail[i_2] + 1 : 0) : lgtail[i_1] + 1));
    }
    if (prv >= 0) tails[now].push_back(uptail[now]);
    sort(ALL(tails[now]));
}

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);
    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);
        }
        REP(j, d) mmax(ret[tails[i][j] * 2], 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));
        REP(j, vec.size()) mmax(ret[vec[j] * 2], (int)vec.size() - j);
    }

    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;
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)
{
    int i_1 = -1, i_2 = -1;
    for (auto nxt : e[now]) if (nxt != prv)
    {
        if (i_1 < 0) i_1 = nxt;
        else if (lgtail[nxt] >= lgtail[i_1])
        {
            i_2 = i_1;
            i_1 = nxt;
        }
        else if (i_2 < 0 or lgtail[nxt] >= lgtail[i_2])
        {
            i_2 = nxt;
        }
        tails[now].push_back(lgtail[nxt] + 1);
    }
    if (prv >= 0) uptail[now] = max(uptail[prv], len) + 1;

    for (auto nxt : e[now]) if (nxt != prv)
    {
        dfs_uptail(nxt, now, (nxt == i_1 ? (i_2 > 0 ? lgtail[i_2] + 1 : 0) : lgtail[i_1] + 1));
    }
    if (prv >= 0) tails[now].push_back(uptail[now]);
    sort(ALL(tails[now]));
}

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);
    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);
        }
        REP(j, d) mmax(ret[tails[i][j] * 2], d - j);
    }

    FOR(c, 1, N) {
        int p = par[c];
        vector<int> vec = tails[p];
        vec.insert(vec.end(), ALL(tails[c]));
        for (auto &x : vec) if (x == lgtail[c] + 1) { x = 0; break; }
        for (auto &x : vec) if (x == uptail[c]) { x = 0; break; }
        sort(ALL(vec));
        FOR(j, 2, vec.size()) mmax(ret[vec[j] * 2], (int)vec.size() - j);
    }

    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;
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)
{
    int i_1 = -1, i_2 = -1;
    for (auto nxt : e[now]) if (nxt != prv)
    {
        if (i_1 < 0) i_1 = nxt;
        else if (lgtail[nxt] >= lgtail[i_1])
        {
            i_2 = i_1;
            i_1 = nxt;
        }
        else if (i_2 < 0 or lgtail[nxt] >= lgtail[i_2])
        {
            i_2 = nxt;
        }
        tails[now].push_back(lgtail[nxt] + 1);
    }
    if (prv >= 0) uptail[now] = max(uptail[prv], len) + 1;

    for (auto nxt : e[now]) if (nxt != prv)
    {
        dfs_uptail(nxt, now, (nxt == i_1 ? (i_2 > 0 ? lgtail[i_2] + 1 : 0) : lgtail[i_1] + 1));
    }
    if (prv >= 0) tails[now].push_back(uptail[now]);
    sort(ALL(tails[now]));
}

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);
    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);
        }
        REP(j, d) mmax(ret[tails[i][j] * 2], d - j);
    }

    FOR(c, 1, N) {
        int p = par[c];
        vector<int> vec = tails[p];
        copy(ALL(tails[c]), back_inserter(vec));
        for (auto &x : vec) if (x == lgtail[c] + 1) { x = 0; break; }
        for (auto &x : vec) if (x == uptail[c]) { x = 0; break; }
        sort(ALL(vec));
        FOR(j, 2, vec.size()) mmax(ret[vec[j] * 2], (int)vec.size() - j);
    }

    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;
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)
{
    int i_1 = -1, i_2 = -1;
    for (auto nxt : e[now]) if (nxt != prv)
    {
        if (i_1 < 0) i_1 = nxt;
        else if (lgtail[nxt] >= lgtail[i_1])
        {
            i_2 = i_1;
            i_1 = nxt;
        }
        else if (i_2 < 0 or lgtail[nxt] >= lgtail[i_2])
        {
            i_2 = nxt;
        }
        tails[now].push_back(lgtail[nxt] + 1);
    }
    if (prv >= 0) uptail[now] = max(uptail[prv], len) + 1;

    for (auto nxt : e[now]) if (nxt != prv)
    {
        dfs_uptail(nxt, now, (nxt == i_1 ? (i_2 > 0 ? lgtail[i_2] + 1 : 0) : lgtail[i_1] + 1));
    }
    if (prv >= 0) tails[now].push_back(uptail[now]);
    sort(ALL(tails[now]));
}

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);
    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 = tails[p];
        vec.insert(vec.end(), ALL(tails[c]));
        for (auto &x : vec) if (x == lgtail[c] + 1) { x = 0; break; }
        for (auto &x : vec) if (x == uptail[c]) { x = 0; break; }
        sort(ALL(vec));
        FOR(j, 2, vec.size()) mmax(ret[vec[j] * 2], (int)vec.size() - j);
    }

    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;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
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 SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#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 T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
///// This part below is only for debug, not used /////
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 deque<T> &vec){ os << "deq["; 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; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
///// END /////

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

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

vector<map<int, 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][lgtail[nxt] + 1]++;
    if (prv >= 0)
    {
        uptail[now] = max(uptail[prv], len) + 1;
        tails[now][uptail[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);
    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 nb = e[i].size();
        for (auto p : tails[i]) {
            if (p.second > 1 and p.first > 1)
            {
                mmax(ret[p.first * 2 - 1], nb);
            }
            mmax(ret[p.first * 2 + 1], nb - p.second + 1);
            mmax(ret[p.first * 2], nb);
            mmax(ret[p.first], 2);
            nb -= p.second;
        }
    }

    // dbg(tails);

    FOR(c, 1, N) {
        int p = par[c];
        if (tails[p].size() <= 1 or tails[c].size() <= 1) continue;
        map<int, int> ma = tails[p];
        for (auto p : tails[c]) ma[p.first] += p.second;
        ma[lgtail[c] + 1]--;
        ma[uptail[c]]--;
        // dbg(c);
        // dbg(ma);
        int nb = 0;
        for (auto p : ma) nb += p.second;
        for (auto p : ma) if (p.second) {
            mmax(ret[p.first * 2], nb);
            nb -= p.second;
        }
    }

    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;
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);
    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);
        }
        REP(j, d) mmax(ret[tails[i][j] * 2], 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;
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);
    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);
        }
        REP(j, d) mmax(ret[tails[i][j] * 2], d - j);
    }

    FOR(c, 1, N) {
        int p = par[c];
        if (tails[p].size() <= 1 or tails[c].size() <= 1) continue;
        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));
        REP(j, vec.size()) {
            mmax(ret[vec[j] * 2], (int)vec.size() - j);
        }
    }

    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;
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]));
    int i_maxi = max_element(ALL(tails[now])) - tails[now].begin();
    int second_maxi = 0;
    REP(i, tails[now].size()) if (i != i_maxi) mmax(second_maxi, tails[now][i]);

    for (auto nxt : e[now]) if (nxt != prv)
    {
        dfs_uptail(nxt, now, nxt == i_maxi ? second_maxi : tails[now][i_maxi]);
    }
}

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);
    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);
        }
        REP(j, d) mmax(ret[tails[i][j] * 2], 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));
        REP(j, vec.size()) {
            mmax(ret[vec[j] * 2], (int)vec.size() - j);
        }
    }

    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;
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)
{
    int i_1 = -1, i_2 = -1;
    for (auto nxt : e[now]) if (nxt != prv)
    {
        if (i_1 < 0) i_1 = nxt;
        else if (lgtail[nxt] >= lgtail[i_1])
        {
            i_2 = i_1;
            i_1 = nxt;
        }
        else if (i_2 < 0 or lgtail[nxt] >= lgtail[i_2])
        {
            i_2 = nxt;
        }
        tails[now].push_back(lgtail[nxt] + 1);
    }
    if (prv >= 0) uptail[now] = max(uptail[prv], len) + 1;

    for (auto nxt : e[now]) if (nxt != prv)
    {
        dfs_uptail(nxt, now, (nxt == i_1 ? (i_2 > 0 ? lgtail[i_2] + 1 : 0) : lgtail[i_1] + 1));
    }
    if (prv >= 0) tails[now].push_back(uptail[now]);
    sort(ALL(tails[now]));
}

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);
    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);
        }
        REP(j, d) mmax(ret[tails[i][j] * 2], 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));
        REP(j, vec.size()) mmax(ret[vec[j] * 2], (int)vec.size() - j);
    }

    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;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
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 SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#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 T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
///// This part below is only for debug, not used /////
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 deque<T> &vec){ os << "deq["; 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; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
///// END /////

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

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

vector<map<int, 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][lgtail[nxt] + 1]++;
    if (prv >= 0)
    {
        uptail[now] = max(uptail[prv], len) + 1;
        tails[now][uptail[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);
    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 nb = 0;
        for (auto p : tails[i])  nb += p.second;
        for (auto p : tails[i]) {
            if (p.second > 1 and p.first > 1)
            {
                mmax(ret[p.first * 2 - 1], nb);
            }
            if (p.second == 1) {
                mmax(ret[p.first * 2 + 1], nb);
            }
            mmax(ret[p.first * 2], nb);
            mmax(ret[p.first], 2);

            nb -= p.second;
        }
    }

    // dbg(tails);

    FOR(c, 1, N) {
        int p = par[c];
        map<int, int> ma = tails[p];
        for (auto p : tails[c]) ma[p.first] += p.second;
        ma[lgtail[c] + 1]--;
        ma[uptail[c]]--;
        // dbg(c);
        // dbg(ma);
        int nb = 0;
        for (auto p : ma) nb += p.second;
        for (auto p : ma) if (p.second) {
            mmax(ret[p.first * 2], nb);
            nb -= p.second;
        }
    }

    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;
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)
{
    int i_1 = -1, i_2 = -1;
    for (auto nxt : e[now]) if (nxt != prv)
    {
        if (i_1 < 0) i_1 = nxt;
        else if (lgtail[nxt] >= lgtail[i_1])
        {
            i_2 = i_1;
            i_1 = nxt;
        }
        tails[now].push_back(lgtail[nxt] + 1);
    }
    if (prv >= 0) uptail[now] = max(uptail[prv], len) + 1;

    for (auto nxt : e[now]) if (nxt != prv)
    {
        dfs_uptail(nxt, now, (nxt == i_1 ? lgtail[i_2] : lgtail[i_1]) + 1);
    }
    if (prv >= 0) tails[now].push_back(uptail[now]);
    sort(ALL(tails[now]));
}

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);
    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);
        }
        REP(j, d) mmax(ret[tails[i][j] * 2], 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));
        REP(j, vec.size()) mmax(ret[vec[j] * 2], (int)vec.size() - j);
    }

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