n = int(input()) g = [[] for _ in range(n)] for _ in range(n-1): a,b = map(int,input().split()) g[a-1].append(b-1) g[b-1].append(a-1) leaf = [v for v in range(n) if len(g[v]) == 1] three = [v for v in range(n) if len(g[v]) == 0] if len(three) >= 2: print("No") exit() if len(three) == 0: print("Yes") exit() s = three[0] dist = [-1]*n dist[s] = 0 parent = [-1]*n q = [s] for v in q: for c in g[v]: if c == parent[v]: continue parent[c] = v dist[c] = dist[v] + 1 q.append(c) v = leaf[0] print("Yes" if all(dist[v] == dist[vi] for vi in leaf) else "No")