#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#define PB push_back
#define ll long long
using  namespace std;
template <class T>
inline void read(T &x)
{
   x=0; char c=getchar(); int f=1;
   while(!isdigit(c)){if(c=='-')f=-1; c=getchar();}
   while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=2e5+10;
vector<int> G[N];
int ans[N],sub[N],p[N],son[N],head[N],sz[N],ecnt,n;
int fa[N],mx[N];
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
struct ed{int to,next;}e[N<<1];
void ad(int x,int y)
{
	e[++ecnt]=(ed){y,head[x]}; head[x]=ecnt;
	e[++ecnt]=(ed){x,head[y]}; head[y]=ecnt;
}
void dfs1(int u,int last)
{
	p[u]=last,mx[u]=max(mx[last],last);
	//if(mx[u]) G[mx[u]].PB(u);
	for(int k=head[u];k;k=e[k].next)
	{
		int v=e[k].to; if(v==last) continue;
		dfs1(v,u);
	}
}
void dfs2(int u)
{
	if(u!=1) ans[u]+=ans[mx[u]]-sub[son[mx[u]]];
	for(int k=head[u];k;k=e[k].next)
	{
		int v=e[k].to; if(v==p[u]) continue;
		son[u]=v,dfs2(v);
	}
}
void un(int x,int y)
{
	int fx=find(x),fy=find(y);
	if(sz[fx]>sz[fy]) swap(fx,fy);
	fa[fx]=fy,sz[fy]+=sz[fx];
}
int main()
{
	int x,y; read(n);
	for(int i=1;i<n;i++) read(x),read(y),ad(x,y);
	dfs1(1,0);
	for(int i=1;i<=n;i++) fa[i]=i,sz[i]=1;
	for(int i=2;i<=n;i++) G[mx[i]].PB(i);
	for(int i=1;i<=n;i++)
	{
		int tot=G[i].size();
		for(int j=0;j<tot;j++)
		{
			int u=G[i][j]; ans[u]=1;
			if(u<i) ans[u]+=sz[find(u)]-1;
			else
			{
				for(int k=head[u];k;k=e[k].next)
				{
					int v=e[k].to;
					if(v<i)
					{
						if(v!=p[u]) sub[v]=sz[find(v)];
						ans[u]+=sz[find(v)];
					}
				}
			}
		}
		for(int k=head[i];k;k=e[k].next)
		{
			int v=e[k].to;
			if(v<i) un(v,i);
		}
	}
	dfs2(1);
	for(int i=2;i<=n;i++) printf("%d ",ans[i]); puts("");
	return 0;
}