n=int(input()) S=[set()]*(n+1) for i in range(n-1): u,v=map(int,input().split()) S[u]=S[u]|{v} S[v]=S[v]|{u} for i in range(1,n+1): T=set() for j in S[i]: T=T|S[j] print(len(T-{i}))