#include #include #include #include #include #include #include #include #include #include using namespace std; #define int long long int MOD = 1000000007; struct UnionFind { vector data; UnionFind(int size) : data(size, -1) { } bool unionSet(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; } return x != y; } bool findSet(int x, int y) { return root(x) == root(y); } int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); } int size(int x) { return -data[root(x)]; } }; signed main() { cin.tie(0); ios::sync_with_stdio(false); int N ,M; cin >> N >> M; vector c(N, 0); int res = 0; int a, b; UnionFind uf(N); for (int i = 0; i < M; i++) { cin >> a >> b; c[a]++; c[b]++; uf.unionSet(a, b); } for (int i = 0; i < N; i++) { if (c[i] > 0) { a = uf.root(i); break; } } bool f = true; for (int i = 0; i < N; i++) { if (c[i] > 0 && a != uf.root(i)) { f = false; break; } } if (f) { int cc = 0; for (int i = 0; i < N; i++) { if (c[i] % 2 == 1) { cc++; } } if (cc != 0 && cc != 2) { f = false; } } if (f) { cout << "YES" << endl; } else { cout << "NO" << endl; } }