from collections import deque N = int(input()) G = {i:[] for i in range(1,N+1)} for _ in range(N-1): a,b = map(int,input().split()) G[a].append(b) G[b].append(a) d1 = [-1 for _ in range(N+1)] d1[1] = 0 que = deque([(1,d)]) while que: x,d = que.popleft() for y in G[x]: if d1[y]<0: d1[y]=d+1 que.append((y,d+1)) dmax = 0 for i in range(1,N+1): if dmax