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() if dist == 2: cnt += 1 if dist > 2: break for next in tree[now]: if next in visited: continue visited.add(next) que.append((next, dist+1)) return cnt for i in range(N): print(bfs(i))