N = int(input()) UV = [list(map(int, input().split())) for _ in range(N-1)] ANS = [0]*N L = [[] for _ in range(N)] for u,v in UV: L[u-1].append(v-1) L[v-1].append(u-1) for i in range(N): cnt = len(L[i]) for l in L[i]: ANS[l]+=cnt-1 for ans in ANS: print(ans)