N = int(input()) e = [[] for _ in range(N)] import sys sys.setrecursionlimit(5000000) for _ in range(N-1): a,b = map(int,input().split()) a -= 1 b -= 1 e[a].append(b) e[b].append(a) ans = [-1]*(N) I = 0 visited = [False]*N visited[0] = True def dfs1(x): global I for ix in e[x]: if visited[ix]: continue visited[ix] = True if ix