from collections import deque N = int(input()) tree = [set() for _ in range(N)] for i in range(N-1): a, b = map(lambda x: int(x) - 1, input().split()) tree[a].add(b) tree[b].add(a) def bfs(a): visited = set([a]) que = deque([(a, 0)]) cnt = 0 while que: now, dist = que.popleft() for next in tree[now]: if next in visited: continue visited.add(next) if dist+1 == 2: cnt += 1 else: que.append((next, dist+1)) return cnt for i in range(N): print(bfs(i))