#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
namespace ywy{
	inline int get(){
		int n=0;char c;while((c=getchar())||23333){
			if(c>='0'&&c<='9')break;if(c=='-')goto s;
		}n=c-'0';while((c=getchar())||23333){
			if(c>='0'&&c<='9')n=n*10+c-'0';else return(n);
		}s:while((c=getchar())||23333){
			if(c>='0'&&c<='9')n=n*10-c+'0';else return(n);
		}
	}
	typedef struct _b{
		int dest;int nxt;
	}bian;bian memchi[1000001];int gn=1,heads[200001],fa[200001],dfn[200001],size[200001],gdfn=1;
	inline void add(int s,int t){
		memchi[gn].dest=t;memchi[gn].nxt=heads[s];heads[s]=gn;gn++;
	}int data[20000001],lef[20000001],rgh[20000001],gseg=1;
	void insert(int l,int r,int &tree,int pt){
		if(!tree)tree=gseg,gseg++;data[tree]++;if(l==r)return;int mid=(l+r)>>1;
		if(pt<=mid)insert(l,mid,lef[tree],pt);else insert(mid+1,r,rgh[tree],pt);
	}
	int united(int a,int b){
		if(!(a&&b))return(a|b);data[a]+=data[b];lef[a]=united(lef[a],lef[b]);rgh[a]=united(rgh[a],rgh[b]);return(a);
	}int ints[200001];vector<int> vec[200001],sub[200001];int f[200001],maxn[200001];
	void dfs(int pt,int baba,int mx){
		dfn[pt]=gdfn;gdfn++;size[pt]=1;maxn[pt]=mx;fa[pt]=baba;if(pt!=1){
			if(baba==1)f[pt]=1;else{
				if(pt>maxn[baba]){
					vec[mx].push_back(pt);f[pt]++;
				}else{
					if(baba==mx){
						vec[baba].push_back(pt);sub[maxn[baba]].push_back(pt);
					}
				}
			}
		}for(register int i=heads[pt];i;i=memchi[i].nxt){
			if(memchi[i].dest==baba)continue;dfs(memchi[i].dest,pt,max(mx,pt));size[pt]+=size[memchi[i].dest];
		}
	}
	void efs(int pt,int baba){
		for(register int i=heads[pt];i;i=memchi[i].nxt){
			if(memchi[i].dest==baba)continue;f[memchi[i].dest]+=f[pt];efs(memchi[i].dest,pt);
		}
	}
	int find(int n){
		if(ints[n]==n)return(n);return(ints[n]=find(ints[n]));
	}int rt[200001];
	int query(int rl,int rr,int l,int r,int tree){
		if(rl>rr||!data[tree])return(0);if(rl==l&&rr==r)return(data[tree]);int mid=(l+r)>>1;
		if(rl>mid)return(query(rl,rr,mid+1,r,rgh[tree]));if(rr<=mid)return(query(rl,rr,l,mid,lef[tree]));
		return(query(rl,mid,l,mid,lef[tree])+query(mid+1,rr,mid+1,r,rgh[tree]));
	}
	void ywymain(){
		int n=get();for(register int i=1;i<n;i++){
			int s=get(),t=get();add(s,t);add(t,s);
		}dfs(1,0,0);for(register int i=1;i<=n;i++)ints[i]=i,insert(1,n,rt[i],dfn[i]);
		for(register int i=1;i<=n;i++){
			for(register int j=heads[i];j;j=memchi[j].nxt){
				if(memchi[j].dest>i)continue;
				int aa=find(i),ab=find(memchi[j].dest);if(aa==ab)continue;ints[aa]=ab;rt[ab]=united(rt[aa],rt[ab]);
			}for(register int j=0;j<vec[i].size();j++){
				for(register int k=heads[vec[i][j]];k;k=memchi[k].nxt){
					if(memchi[k].dest==fa[vec[i][j]]||memchi[k].dest>i)continue;
					f[vec[i][j]]+=query(dfn[memchi[k].dest],dfn[memchi[k].dest]+size[memchi[k].dest]-1,1,n,rt[find(memchi[k].dest)]);
			//		printf("f[%d]+=%d\n",vec[i][j],query(dfn[memchi[k].dest],dfn[memchi[k].dest]+size[memchi[k].dest]-1,1,n,rt[find(memchi[k].dest)]));
				}
			}for(register int j=0;j<sub[i].size();j++){
				for(register int k=heads[sub[i][j]];k;k=memchi[k].nxt){
					if(memchi[k].dest==fa[sub[i][j]]||memchi[k].dest>i)continue;
					f[sub[i][j]]-=query(dfn[memchi[k].dest],dfn[memchi[k].dest]+size[memchi[k].dest]-1,1,n,rt[find(memchi[k].dest)]);
				}
			}
		}efs(1,0);for(register int i=2;i<=n;i++)printf("%d ",f[i]);
	}
}
int main(){
	ywy::ywymain();return(0);
}

Measured memory_bytes: 80640