from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N = int(input()) e = [[] for _ in range(N)] for _ in range(N-1): u,v = map(int,input().split()) u -= 1 v -= 1 e[u].append(v) e[v].append(u) for i in range(N): x = sum(len(e[j]) for j in e[i]) print(x-len(e[i]))