import sys input = sys.stdin.readline N=int(input()) E=[[] for i in range(N)] ED=[0]*N for i in range(N-1): x,y=map(int,input().split()) E[x-1].append(y-1) E[y-1].append(x-1) ED[x-1]+=1 ED[y-1]+=1 for i in range(N): if ED[i]==1: Q=[i] init=i break L=[0]*N while Q: x=Q.pop() for to in E[x]: if L[to]==0: L[to]=L[x]+1 Q.append(to) flag=1 MAX=max(L) for i in range(N): if ED[i]==1: if L[i]==MAX or i==init: True else: print("No") break else: print("Yes")