#include <map>
#include <cstdio>
using namespace std;

const int MAXN = 2e5 + 5;

template<typename _T>
void read( _T &x )
{
	x = 0;char s = getchar();int f = 1;
	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}
	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}
	x *= f;
}

template<typename _T>
void write( _T x )
{
	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }
	if( 9 < x ){ write( x / 10 ); }
	putchar( x % 10 + '0' );
}

template<typename _T>
_T MAX( const _T a, const _T b )
{
	return a > b ? a : b;
}

struct edge
{
	int to, nxt;
}Graph[MAXN << 1];

map<int, int> q[MAXN];

int mx[MAXN], c[MAXN];
int head[MAXN];
int N, cnt;

void addEdge( const int from, const int to )
{
	Graph[++ cnt].to = to, Graph[cnt].nxt = head[from];
	head[from] = cnt;
}

int Q( const int u, const int fa, const int val )
{
	if( q[u][val] ) return q[u][val];
	q[u][val] = 1;
	for( int i = head[u], v ; i ; i = Graph[i].nxt )
		if( ( v = Graph[i].to ) ^ fa && v < val )
			q[u][val] += Q( v, u, val );
	return q[u][val];
}

void DFS( const int u, const int fa )
{
	mx[u] = MAX( u, mx[fa] );
	for( int i = head[u], v ; i ; i = Graph[i].nxt )
		if( ( v = Graph[i].to ) ^ fa )
		{
			if( mx[u] == u )
			{
				c[v] = c[u] + Q( v, u, mx[u] );
				if( v < mx[fa] ) c[v] -= Q( v, u, mx[fa] );
			}
			else
			{
				if( v < mx[u] ) c[v] = c[u];
				else c[v] = c[u] + Q( v, u, mx[u] );
			}
			DFS( v, u );
		}
}

int main()
{
	read( N );
	for( int i = 1, a, b ; i < N ; i ++ )
		read( a ), read( b ), addEdge( a, b ), addEdge( b, a );
	DFS( 1, 0 );
	for( int i = 2 ; i <= N ; i ++ ) write( c[i] ), putchar( i == N ? '\n' : ' ' );
	return 0;
}