//pantyhose(black) + glasses = infinity

#include <bits/stdc++.h>
using namespace std;

#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "tkhs"

const int MAX_N = 200002;

class fenwick_tree {
public:

    int n;
    vector<int> bit;

    void init(int _n) {
        n = _n;
        bit.resize(n+1);
    }

    void upd(int id, int val) {
        for (; id<=n; id += id & -id)
            bit[id] += val;
    }

    void upd(int u, int v, int val) {
        upd(u, val);
        upd(v+1, -val);
    }

    int get(int id) {
        int res = 0;
        for (; id>0; id -= id & -id)
            res += bit[id];
        return res;
    }
};

namespace dsu {
    int lab[MAX_N];

    int findset(int u) {
        return lab[u]<=0 ? u : lab[u] = findset(lab[u]);
    }

    void uni(int s, int t) {
        s = findset(s);
        t = findset(t);
        if (s!=t)
            lab[t] = s;
    }
}

int n, nTime, par[MAX_N], T[MAX_N], f[MAX_N], x[MAX_N];
int nxt[MAX_N], in[MAX_N];
vector<int> g[MAX_N];
fenwick_tree tr;

void read_input() {
    cin >> n;
    for (int i=1; i<n; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
}

int fix_root(int u) {
    int cur = 0;
    int sz = 0;
    for (auto &v : g[u]) {
        if (v!=par[u]) {
            par[v] = u;
            T[v] = max(u, T[u]);
            int tmp = fix_root(v);
            if (tmp > cur) {
                swap(g[u][0], v);
                cur = tmp;
            }
            sz += tmp;
        }
    }
    return sz;
}

void dfs_hld(int u) {
    in[u] = ++nTime;
    for (auto v : g[u]) {
        if (v!=par[u]) {
            nxt[v] = (v==g[u][0] ? nxt[u] : v);
            dfs_hld(v);
        }
    }
}

int dp(int u) {
    if (f[u]>-1)
        return f[u];
    if (u==1)
        return f[u]=1;
    int res = dp(par[u]) - x[u] + 1;
    for (auto v : g[u]) {
        if (v!=par[u])
            res += x[v];
    }
    return f[u] = res;
}

void upd(int u, int anc, int cnt) {
    if (nxt[u]==nxt[anc]) {
        tr.upd(in[anc]+1, in[u], cnt);
        return;
    }
    tr.upd(in[nxt[u]], in[u], cnt);
    upd(par[nxt[u]], anc, cnt);
}

int get(int u) {
    return tr.get(in[u]);
}

void add_node(int u) {
    if (par[u])
        dsu::uni(par[u], u);
    int cnt = 1;
    for (auto v : g[u]) {
        if (v!=par[u] && v<u) {
            cnt += get(v);
            dsu::uni(u, v);
        }
    }
//    cerr << u << ' ' << dsu::findset(u) << ' ' << cnt << '\n';
    upd(u, dsu::findset(u), cnt);
}

void solve() {
    tr.init(n);
    vector<pair<int, int> > q;
    for (int i=2; i<=n; ++i)
        q.push_back(make_pair(T[par[i]], i));
    sort(q.begin(), q.end());
    for (int i=0, _prev=1; i<q.size(); ++i) {
        int u = q[i].second, cur = q[i].first;
        for (int v=_prev; v<=cur; ++v)
            add_node(v);
//        debug(get(3));
        x[u] = get(u);
        _prev = cur + 1;
    }
    memset(f, -1, sizeof(f));
    for (int i=2; i<=n; ++i)
        cout << dp(i)-1 << ' ';
}

int main() {
	#ifdef GLASSES_GIRL
		freopen(FILE_NAME".inp", "r", stdin);
		freopen(FILE_NAME".out", "w", stdout);
	#endif
	ios::sync_with_stdio(0); cin.tie(0);
    read_input();
    fix_root(1);
    dfs_hld(1);
    solve();
}



Measured memory_bytes: 36084