import sys sys.setrecursionlimit(10 ** 8) N,M = map(int,input().split()) C = 2 * N parent = list(range(C)) def find(i): if parent[i] == i:return i parent[i] = find(parent[i]) return parent[i] def unite(i,j): I = find(i) J = find(j) if I == J:return False parent[I] = J parent[i] = J return True def isSame(i,j): return find(i) == find(j) for _ in range(M): a,b = map(int,input().split()) a -= 1 b -= 1 unite(a,b + N) unite(a + N,b) for i in range(N): if find(i) != find(i + N): print('No') exit() print('Yes')