N = int(input()) G = [[] for _ in range(N+1)] for _ in range(N-1): u,v = map(int,input().split()) G[u].append(v) G[v].append(u) memo = [0] * (N+1) import sys sys.setrecursionlimit(10 ** 6) def calc(now = 1,parent = 0): if now != 1 and len(G[now]) == 1: memo[now] = 1 return 1 ans = 1 for v in G[now]: if v != parent: ans += calc(v,now) memo[now] = ans return ans calc() for k in range(1,N+1): ans = memo[k] * 2 - 1 if k == 1: if len(G[k]) == 1: print(ans) continue else: for v in range(len(G[k])-1): for w in range(v+1,len(G[k])): v = G[k][v] w = G[k][w] ans += memo[v] * memo[w] * 2 print(ans) else: if len(G[k]) <= 2: print(ans) continue else: for v in range(len(G[k]) - 1): for w in range(v+1,len(G[k])): v = G[k][v] w = G[k][w] if memo[v] < memo[k] and memo[w] < memo[k] and v != w: ans += memo[v] * memo[w] * 2 print(ans)