import sys input = sys.stdin.readline N = int(input()) G = [[] for _ in range(N)] for _ in range(N-1): u, v = map(int, input().split()) u -= 1 v -= 1 G[u].append(v) G[v].append(u) ans = [0] * N for u in range(N): for v in G[u]: ans[u] += len(G[v]) ans[u] -= len(G[u]) print(*ans, sep="\n")