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

const int N = 200005;
int n, fa[N], mx[N][2], st[N], ed[N], dfs_clock, ans[N];
vector<int> g[N], vmx[N][2];

void dfs(int u) {
	st[u] = ++dfs_clock;
	for (int i = 0; i < 2; ++i)
		vmx[mx[u][i]][i].push_back(dfs_clock);
	for (int v : g[u])
		if (v != fa[u]) {
			fa[v] = u;
			if (v > mx[u][0])
				mx[v][0] = v, mx[v][1] = mx[u][0];
			else
				mx[v][0] = mx[u][0], mx[v][1] = max(v, mx[u][1]);
			dfs(v);
		}
	ed[u] = dfs_clock;
}
int query(const vector<int> &v, int t) {
	return upper_bound(v.begin(), v.end(), ed[t]) - lower_bound(v.begin(), v.end(), st[t]);
}

void solve(int u) {
	for (int v : g[u])
		if (v != fa[u]) {
			if (v > mx[fa[u]][0])
				ans[v] = ans[u] + query(vmx[mx[u][0]][v > mx[u][0]], v);
			else
				ans[v] = ans[u] + (u > mx[fa[u]][0] ? query(vmx[u][0], v) - query(vmx[mx[fa[u]][0]][1], v) : 0);
			solve(v);
		}
}

int main() {
	scanf("%d", &n);
	for (int i = 1, u, v; i < n; ++i) {
		scanf("%d%d", &u, &v);
		g[u].push_back(v), g[v].push_back(u);
	}
	mx[1][0] = 1, dfs(1);
	solve(1);
	for (int i = 2; i <= n; ++i)
		printf("%d%c", ans[i], " \n"[i == n]);
	return 0;
}
