import sys input = sys.stdin.readline from collections import * class Unionfind: def __init__(self, n): self.par = [-1]*n self.rank = [1]*n def root(self, x): r = x while not self.par[r]<0: r = self.par[r] t = x while t!=r: tmp = t t = self.par[t] self.par[tmp] = r return r def unite(self, x, y): rx = self.root(x) ry = self.root(y) if rx==ry: return if self.rank[rx]<=self.rank[ry]: self.par[ry] += self.par[rx] self.par[rx] = ry if self.rank[rx]==self.rank[ry]: self.rank[ry] += 1 else: self.par[rx] += self.par[ry] self.par[ry] = rx def is_same(self, x, y): return self.root(x)==self.root(y) def count(self, x): return -self.par[self.root(x)] N, M = map(int, input().split()) G = [[] for _ in range(N)] uf = Unionfind(N) for _ in range(M): u, v = map(int, input().split()) G[u-1].append(v-1) G[v-1].append(u-1) uf.unite(u-1, v-1) rs = set(uf.root(v) for v in range(N)) color = [0]*N for r in rs: q = deque([r]) color[r] = 1 odd_cycle = False while q: v = q.popleft() for nv in G[v]: if color[nv]==0: color[nv] = -color[v] q.append(nv) else: if color[v]==color[nv]: odd_cycle = True if not odd_cycle: exit(print('No')) print('Yes')