#include #include #include using namespace std; struct UnionFind{ vector p; UnionFind(int n): p(vector(n, -1)){} int root(int x){ if(p[x] < 0) return x; else return p[x] = root(p[x]); } int size(int x){ return -p[root(x)]; } bool same(int x, int y){ return root(x) == root(y); } void unite(int x, int y){ if(same(x, y)) return; x = root(x); y = root(y); if(size(x) < size(y)) swap(x, y); p[x] += p[y]; p[y] = x; } }; int main(){ int n, m; cin >> n >> m; UnionFind uf(n*2); for(int i = 0; i < m; i++){ int a, b; cin >> a >> b; a--; b--; uf.unite(a, n+b); uf.unite(n+a, b); } for(int i = 0; i < n; i++){ if(!uf.same(i, n+i)){ cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }