#include using namespace std; struct UnionFind { vector par; UnionFind(int n) : par(n, -1) { } void init(int n) { par.assign(n, -1); } int root(int x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } int size(int x) { return -par[root(x)]; } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; UnionFind uf(2 * n); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--, b--; uf.merge(a, b + n); uf.merge(a + n, b); } bool ok = true; for (int i = 0; i < n; i++) { if (!uf.issame(i, i + n)) { ok = false; } } cout << (ok ? "Yes" : "No") << endl; }