#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f|=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=200005;
int n;
vector <int> e[N];
int depth[N],I[N],O[N],fa[N],Time=0;
int s[N];
void dfs(int x,int pre){
	fa[x]=pre,I[x]=++Time,depth[x]=depth[pre]+1;
	for (auto y : e[x])
		if (y!=pre)
			dfs(y,x);
	O[x]=Time;
}
int ST[N],top=0,d[N];
void solve(int x,int pre,int m1,int m2){
	if (x>m1)
		m2=m1,m1=x;
	else if (x>m2)
		m2=x;
	ST[d[x]=++top]=x;
	if (x>1){
		int f=depth[m1]>depth[m2]?m1:ST[d[m1]+1];
		s[I[f]]++,s[O[f]+1]--;
	}
	for (auto y : e[x])
		if (y!=pre)
			solve(y,x,m1,m2);
	top--;
}
int main(){
	n=read();
	for (int i=1;i<n;i++){
		int x=read(),y=read();
		e[x].push_back(y);
		e[y].push_back(x);
	}
	dfs(1,0);
	solve(1,0,0,0);
	for (int i=1;i<=n;i++)
		s[i]+=s[i-1];
	for (int i=2;i<=n;i++)
		printf("%d ",s[I[i]]);
	return 0;
}