#include <map>
#include <cstdio>

typedef std::pair<int, int> pii;

const int MAXN = 2e5;
int n, ecnt, head[MAXN + 5], fa[MAXN + 5], mx[MAXN + 5], ans[MAXN + 5];
std::map<pii, int> rch;

struct Edge { int to, nxt; } graph[MAXN * 2 + 5];

inline int max_ ( const int a, const int b ) { return a < b ? b : a; }

inline void link ( const int s, const int t ) {
	graph[++ ecnt] = { t, head[s] };
	head[s] = ecnt;
}

inline void init ( const int u ) {
	mx[u] = max_ ( u, mx[fa[u]] );
	for ( int i = head[u], v; i; i = graph[i].nxt ) {
		if ( ( v = graph[i].to ) ^ fa[u] ) {
			fa[v] = u, init ( v );
		}
	}
}

inline int reach ( const int u, const int lim ) {
	pii sta ( u, lim );
	if ( rch.count ( sta ) ) return rch[sta];
	int ret = 1;
	for ( int i = head[u], v; i; i = graph[i].nxt ) {
		if ( ( v = graph[i].to ) ^ fa[u] && v < lim ) {
			ret += reach ( v, lim );
		}
	}
	return rch[sta] = ret;
}

inline void solve ( const int u ) {
	for ( int i = head[u], v; i; i = graph[i].nxt ) {
		if ( ( v = graph[i].to ) ^ fa[u] ) {
			if ( mx[v] == v ) ans[v] = reach ( v, mx[u] );
			else if ( mx[u] == u ) {
				ans[v] = reach ( v, u ) - ( v > mx[fa[u]] ? 0 : reach ( v, mx[fa[u]] ) );
			}
			ans[v] += ans[u];
			solve ( v );
		}
	}
}

int main () {
	scanf ( "%d", &n );
	for ( int i = 1, u, v; i < n; ++ i ) {
		scanf ( "%d %d", &u, &v );
		link ( u, v ), link ( v, u );
	}
	init ( 1 );
	solve ( 1 );
	for ( int i = 2; i <= n; ++ i ) printf ( "%d%c", ans[i], i ^ n ? ' ' : '\n' );
	return 0;
}