class UnionFind: def __init__(self, n): self.n = n self.par = [-1] * n self.group_ = n def find(self, x): if self.par[x] < 0: return x lst = [] while self.par[x] >= 0: lst.append(x) x = self.par[x] for y in lst: self.par[y] = x return x def unite(self, x, y): x = self.find(x) y = self.find(y) if x == y: return False if self.par[x] > self.par[y]: x, y = y, x self.par[x] += self.par[y] self.par[y] = x self.group_ -= 1 return True def size(self, x): return -self.par[self.find(x)] def same(self, x, y): return self.find(x) == self.find(y) @property def group(self): return self.group_ n, m = map(int, input().split()) UF = UnionFind(2 * n) for _ in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 UF.unite(a, b + n) UF.unite(a + n, b) for i in range(n): if UF.same(i, i + n): print("No") exit() print("Yes")