#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define fi(a, b) for(int i=a; i<=b; i++)
#define fj(a, b) for(int j=a; j<=b; j++)
#define fo(a, b) for(int o=a; o<=b; o++)
#define fdi(a, b) for(int i=a; i>=b; i--)
#define fdj(a, b) for(int j=a; j>=b; j--)
#define fdo(a, b) for(int o=a; o>=b; o--)
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;

char __buffer[100000];

#ifdef _DEBUG
#define LOCAL
#endif

void err(const char *format, ... ) {
#ifdef LOCAL
	va_list ap;
	va_start(ap, format);
	vsprintf(__buffer, format, ap);
	va_end(ap);
	
	fprintf(stderr, "\t%s", __buffer);
#else
	if (format < 0) {
		__buffer[0]++;
	}
#endif
}

void errln(const char *format, ... ) {
#ifdef LOCAL
	va_list ap;
	va_start(ap, format);
	vsprintf(__buffer, format, ap);
	va_end(ap);
	
	fprintf(stderr, "\t%s\n", __buffer);
#else
	if (format < 0) {
		__buffer[0]++;
	}
#endif
}

void errln() {
#ifdef LOCAL	
	fprintf(stderr, "\n");
#endif	
}

double START_TIME;

void exit() {
#ifdef LOCAL	
	cerr << "TIME: " << setprecision(5) << fixed << (clock() - START_TIME) / CLOCKS_PER_SEC << endl;
#endif	
	exit(0);
}

template<typename A, typename B>
ostream& operator<<(ostream& os, pair<A, B> p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
	fi(0, sz(v) - 1) {
		os << v[i] << " ";
	}
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T> t) {
	for (auto z : t) {
		os << z << " ";
	}
	return os;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> t) {
	cerr << endl;
	for (auto z : t) {
		os << "\t" << z.first << " -> " << z.second << endl;
	}
	return os;
}

#ifdef LOCAL
#define dbg(x) {cerr << __LINE__ << "\t" << #x << ": " << x << endl;}
#define dbg0(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 0; ABC < n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#define dbg1(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 1; ABC <= n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#else
#define dbg(x) while(0){}
#define dbg0(x, n) while(0){}
#define dbg1(x, n) while(0){}
#endif

#ifdef LOCAL
#define ass(x) if (!(x)) { cerr << __LINE__ << "\tassertion failed: " << #x << endl, abort(); }
#else
#define ass(x) assert(x)
#endif

///////////////////////////////////////////////////

const int MAX = 200 * 1000 + 41;

int n;
vi e[MAX];
int f[MAX];
int maxi[MAX];

int par[MAX];

int tin[MAX];
int tout[MAX];
int cnt;

//tree min

int tmin[MAX * 4];

void updmin(int p, int v, int x = 0, int tl = 1, int tr = n) {
	if (tl == tr) {
		tmin[x] = v;
	} else {
		int tm = (tl + tr) / 2;
		if (p <= tm) {
			updmin(p, v, x * 2 + 1, tl, tm);
		} else {
			updmin(p, v, x * 2 + 2, tm + 1, tr);
		}
		tmin[x] = min(tmin[x * 2 + 1], tmin[x * 2 + 2]);
	}
}

const int INF = 1000 * 1000 * 1000 + 41;

int getmin(int l, int r, int x = 0, int tl = 1, int tr = n) {
	if (l > tr || tl > r) return INF;
	if (l <= tl && tr <= r) return tmin[x];
	int tm = (tl + tr) / 2;
	int v1 = getmin(l, r, x * 2 + 1, tl, tm);
	int v2 = getmin(l, r, x * 2 + 2, tm + 1, tr);
	return min(v1, v2);
}

//end

//tree sum

int tsum[MAX * 4];

void updsum(int p, int x = 0, int tl = 1, int tr = n) {
	if (tl == tr) {
		tsum[x] = 1;
	} else {
		int tm = (tl + tr) / 2;
		if (p <= tm) {
			updsum(p, x * 2 + 1, tl, tm);
		} else {
			updsum(p, x * 2 + 2, tm + 1, tr);
		}
		tsum[x] = tsum[x * 2 + 1] + tsum[x * 2 + 2];
	}
}

int getsum(int l, int r, int x = 0, int tl = 1, int tr = n) {
	if (l > tr || tl > r) return 0;
	if (l <= tl && tr <= r) return tsum[x];
	int tm = (tl + tr) / 2;
	int v1 = getsum(l, r, x * 2 + 1, tl, tm);
	int v2 = getsum(l, r, x * 2 + 2, tm + 1, tr);
	return v1 + v2;
}

//end

bool flag[MAX];

void push(int x) {
	if (flag[x]) return;
	flag[x] = 1;		
	updsum(tin[x]);
	updmin(tin[x], INF);
	for (auto y : e[x]) {		
		updmin(tin[y], y);
	}	
}

void dfs(int x) {
	if (x == 1 || maxi[x] > x) push(x);
		
	int l = tin[x];
	int r = tout[x];
	while (1) {
		int b = getmin(l, r);		
//		err("x = %d b = %d maxi = %d\n", x, b, maxi[x]);
		if (b > maxi[x]) break;
		push(b);
	}
	f[x] = getsum(l, r);
	for (auto y : e[x]) {
		dfs(y);
	}
}

int ans[MAX];

void dfs2(int x, int sum = 0) {
	for (auto y : e[x]) {
		sum += f[y];
	}
	ans[x] = sum;
	for (auto y : e[x]) {
		dfs2(y, sum - f[y] + 1);
	}	
}

void solve() {
	fi(1, n) {
		updmin(i, INF);
	}	
	dfs(1);
	dbg1(f, n);
	dfs2(1);
	fi(2, n) {
		if (i > 2) printf(" ");
		printf("%d", ans[i]);
	}
}

void dfs0(int x, int p = -1) {
	par[x] = p;
	cnt++;
	tin[x] = cnt;	
	
	fi(0, sz(e[x]) - 1) {
		if (e[x][i] == p) {
			swap(e[x][i], e[x].back());
			e[x].pop_back();
			break;
		}
	}

	for (auto y : e[x]) {
		if (par[x] != -1) {
			maxi[y] = max(maxi[x], par[x]);
		}
		dfs0(y, x);
	}

	tout[x] = cnt;
}

void init() {
	dfs0(1);
	dbg1(maxi, n);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	START_TIME = (double)clock();
#endif

  scanf("%d", &n);
  fi(1, n - 1) {
  	int x, y;
  	scanf("%d %d", &x, &y);
  	e[x].pb(y);
  	e[y].pb(x);
  }
  init();
	solve();

	exit();
	return 0;
}





Measured memory_bytes: 33024