N = int(input()) adj = [[] for _ in range(N)] for _ in range(N - 1): u, v = map(int, input().split()) u -= 1 v -= 1 adj[u].append(v) adj[v].append(u) ans = [0] * N for i in range(N): for nxt in adj[i]: ans[i] += len(adj[nxt]) - 1 for a in ans: print(a)