import sys import io, os input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline n = int(input()) g = [[] for i in range(n)] for i in range(n-1): a, b = map(int, input().split()) a, b = a-1, b-1 g[a].append(b) g[b].append(a) if n == 2: print('Yes') exit() from collections import deque q = deque([]) for v in range(n): if len(g[v]) == 1: q.append(v) if len(q) == 2: print('Yes') exit() while n > 2: l = len(q) n -= l for i in range(l): v = q.popleft() for u in g[v]: g[u].remove(v) if len(g[u]) == 1: q.append(u) #print(list(q)) if len(q) == 1: print('Yes') else: print('No')