from collections import deque from collections import defaultdict n, m = (int(x) for x in input().split()) l = defaultdict(list) for i in range(m): a, b = (int(x) for x in input().split()) a -= 1 b -= 1 l[str(a)+"up"].append(str(b)+"down") l[str(a)+"down"].append(str(b)+"up") l[str(b)+"up"].append(str(a)+"down") l[str(b)+"down"].append(str(a)+"up") def bfs(u): queue = deque([u]) S = set(); S.add(u) while queue: v = queue.popleft() for i in l[v]: if not i in S: queue.append(i) S.add(i) return S for i in range(n): d = bfs(str(i) + "up") if str(i) + "down" not in d: print("No") exit() print("Yes")