n = int(input()) m = [[] for _ in [0]*n] # 近傍 for _ in [0]*(n-1): a, b = map(int, input().split()) m[a-1] += [b-1] m[b-1] += [a-1] print('YNeos'[sum(len(i)>1for i in m)>1 and any(len(i)>2for i in m)::2])