#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define mt make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; class UnionFind { int cnt; vector par, rank, size; public: UnionFind() {} UnionFind(int _n) :cnt(_n), par(_n), rank(_n), size(_n, 1) { for (int i = 0; i<_n; ++i) par[i] = i; } int find(int k) { return (k == par[k]) ? k : (par[k] = find(par[k])); } int operator[](int k) { return find(k); } int getSize(int k) { return size[find(k)]; } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; --cnt; if (rank[x] < rank[y]) { par[x] = y; size[y] += size[x]; } else { par[y] = x; size[x] += size[y]; if (rank[y] == rank[x]) ++rank[x]; } } int count() { return cnt; } }; bool solve() { int N, M; cin >> N >> M; UnionFind uf(N); vi deg(N); rep(i, M) { int x, y; cin >> x >> y; uf.unite(x, y); deg[x]++; deg[y]++; } int con = N; rep(i, N)if (deg[i] == 0)con--; if (N - con + 1 != uf.count())return false; int odd = 0, even = 0; rep(j, N) if(deg[j]){ if (deg[j] & 1)odd++; else even++; } int num = odd + even; if (num != even && odd != 2)return false; return true; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << (solve() ? "YES" : "NO") << endl; }