#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define Rep(b, e, i) for(int i = b; i <= e; i++) #define Repr(e, b, i) for(int i = e; i >= b; i--) #define rep(n, i) Rep(0, n-1, i) #define repr(n, i) Repr(n-1, 0, i) #define all(v) (v).begin(), (v).end() #define pb(v) push_back(v) #define uniq(v) (v).erase(unique(all(v)),(v).end()) #define bitcnt(x) __builtin_popcount(x) #define fst first #define snd second #define Pqaz(T) priority_queue,greater> #define Pqza(T) priority_queue #define put(x) cout << x; #define putsp(x) cout << x << ' '; #define putln(x) cout << x << endl; #define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0); typedef long long ll; typedef pair llP; typedef pair intP; typedef complex comp; typedef vector vec; typedef vector vecll; typedef vector vecd; typedef vector mat; typedef vector matll; typedef vector matd; //vector の中身を出力 template ostream &operator<<(ostream &o,const vector&v) {o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")< root) vector par; //rank of tree vector rank; UnionFind(int n) : par(n), rank(n, 1) { //initialize rep(n, i) par[i] = i; } //find root (keiroasshuku at the same time) int root(int x){ if (par[x] == x) return x; else return par[x] = root(par[x]); } //unite void unite(int x, int y){ x = root(x); y = root(y); if (x == y) return; if (rank[x] > rank[y]) swap(x, y); par[x] = y; if (rank[x] == rank[y]) rank[y]++; } //same tree? bool same(int x, int y){ return root(x) == root(y); } }; void solve(void){ int N, M; cin >> N >> M; vec ms(2*M); map mp; UnionFind uf(N); rep(M, i) { cin >> ms[2*i] >> ms[2*i+1]; ms[2*i]--, ms[2*i+1]--; mp[ms[2*i]]++; mp[ms[2*i+1]]++; uf.unite(ms[2*i], ms[2*i+1]); } int cnt = 0; for (auto p : mp) { cnt += p.snd & 1; } rep(2*M, i) { if (uf.same(ms[i], ms[0])) { continue; } cout << "NO" << endl; return; } cout << (cnt == 2 || cnt == 0 ? "YES" : "NO") << endl; } int main(void){ solve(); //cout << "yui(*-v・)yui" << endl; return 0; }