#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

typedef long long ll;
typedef long double ld;

const ll SZ = 2e5 + 10;

vector<vector<ll>> gr;
ll n;

const ll LOG = 20;

bool used[SZ];
ll par[SZ], psh[SZ], prefMx[SZ], sn[SZ], up[SZ][LOG], curMx[SZ][LOG], tin[SZ], t = 0;

void dfs(int v) {
	used[v] = 1;

	ll bst = v;
	ll u = v, mx = -1;
	vector<pair<ll, ll>> way;
	while (u != 0) {
		way.push_back({ u, mx });
		mx = max(mx, u);
		u = par[u];
	}
	way.push_back({ 0, mx });
	reverse(way.begin(), way.end());

	ll mx2 = -1;
	for (int i = 0; i < way.size(); i++) {
		if (v < mx2 && way[i].second <= mx2) {
			bst = way[i].first;
			break;
		}
		mx2 = max(mx2, way[i].first);
	}

	psh[bst]++;

	for (auto to : gr[v]) {
		if (!used[to]) {
			par[to] = v;
			dfs(to);
		}
	}
}

ll get(int v, int u) {
	ll curmx = -1;
	for (int i = LOG - 1; i >= 0; i--) {
		ll nw = up[v][i];
		if (tin[nw] > tin[u]) {
			curmx = max(curmx, curMx[v][i]);
			v = nw;
		}
	}

	curmx = max(curmx, curMx[v][0]);
	return curmx;
}

void dfs2(ll v, ll curmx = -1) {
	t++;
	tin[v] = t;
	for (int i = 1; i < LOG; i++) {
		curMx[v][i] = max(curMx[v][i - 1], curMx[up[v][i - 1]][i - 1]);
		up[v][i] = up[up[v][i - 1]][i - 1];
	}
	prefMx[v] = curmx;
	curmx = max(curmx, v);
	used[v] = 1;

	if (v == curmx) {
		psh[v]++;
	}
	else {
		ll vl = v;
		vl = max(vl, get(v, curmx));
		if (prefMx[curmx] > vl) {
			psh[curmx]++;
		}
		else {
			psh[sn[curmx]]++;
		}
	}
	

	for (auto to : gr[v]) {
		if (!used[to]) {
			par[to] = v;
			sn[v] = to;
			up[to][0] = v;
			curMx[to][0] = to;
			dfs2(to, curmx);
		}
	}
}

vector<ll> ans;
void push(int v, int curP = 0) {
	used[v] = 1;
	ans[v] += psh[v] + curP;
	curP += psh[v];

	for (auto to : gr[v]) {
		if (!used[to]) {
			push(to, curP);
		}
	}
}

vector<ll> sol() {
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < LOG; j++) {
			up[i][j] = 0;
			curMx[i][j] = 0;
		}
	}
	for (int i = 0; i < n; i++) psh[i] = 0;
	par[0] = -1;
	ans.clear();
	ans.resize(n);
	for (int i = 0; i < n; i++) used[i] = 0;
	dfs2(0);
	for (int i = 0; i < n; i++) used[i] = 0;
	push(0);
	return ans;
}

vector<ll> stresses() {
	vector<ll> ans(n);
	for (int i = 0; i < n; i++) {
		set<ll> u;
		vector<bool> us(n);
		us[i] = 1;
		u.insert(i);
		ll ops = 0;
		bool fl = true;
		while (fl) {
			ops++;
			ll v = *(u.begin());
			u.erase(v);

			if (v == 0) fl = false;
			for (auto to : gr[v]) {
				if (!us[to]) {
					us[to] = 1;
					u.insert(to);
				}
				if (to == 0) fl = false;
			}
		}

		ans[i] = ops;
	}
	return ans;
}

void input() {
	cin >> n;

	gr.resize(n);
	for (int i = 0; i < n - 1; i++) {
		ll u, v;
		cin >> u >> v;
		u--; v--;
		gr[u].push_back(v);
		gr[v].push_back(u);
	}
}

void rand_test() {
	n = rand() % 100 + 2;

	gr.clear();
	vector<ll> perm;
	for (int i = 0; i < n; i++) perm.push_back(i);

	random_shuffle(perm.begin(), perm.end());
	gr.resize(n);
	for (int i = 1; i < n; i++) {
		ll pr = rand() % i;
		gr[perm[pr]].push_back(perm[i]);
		gr[perm[i]].push_back(perm[pr]);
	}
}

int main() {
	fastInp;

	/*ll t = 1000;
	while (t--) {
		rand_test();
		vector<ll> q = sol(), q2 = stresses();

		bool fl = 0;
		q[0]++;
		for (int i = 0; i < n; i++) {
			if (q[i] - 1 != q2[i]) {
				fl = 1;
			}
		}

		if (fl) {
			cout << "";
			sol();
		}
	}
*/

	input();
	vector<ll> q = sol();

	q.erase(q.begin());
	for (auto cur : q) cout << cur - 1 << " ";
	

	return 0;
}

Measured memory_bytes: 103480