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'[not(sum(len(i)>2for i in m)==1 and sum(len(i)==1for i in m)==n-1 or all(len(i)<3for i in m))::2])