#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(),(a).end() struct UnionFind { vector par, siz; int v, group; UnionFind(int n) { par = vector(n, -1); siz = vector(n, 1); v = n; group = n; } int root(int x) { if (par[x] == -1) return x; else return par[x] = root(par[x]); } bool same(int x, int y) { return root(x) == root(y); } bool unite(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (siz[x] < siz[y]) swap(x, y); par[y] = x; siz[x] += siz[y]; group--; return true; } int size(int x) { return siz[root(x)]; } }; int main() { cin.tie(nullptr); int N, M; cin >> N >> M; UnionFind uf(N * 2); rep(i, 0, M) { int A, B; cin >> A >> B; A--, B--; uf.unite(2*A, 2*B + 1); uf.unite(2*A + 1, 2*B); } bool ok = true; rep(i, 0, N) if (!uf.same(2*i, 2*i + 1)) ok = false; if (ok) cout << "Yes\n"; else cout << "No\n"; }