#include #include #include using namespace std; struct UnionFind { vector data; int __size; UnionFind(int size) : data(size, -1), __size(size) { } bool unionSet(int x, int y) { if ((x = root(x)) != (y = root(y))) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; __size--; } 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)]; } int size() { return __size; } }; int main() { int n, m; cin >> n >> m; vector deg(n); UnionFind uf(n); while (m--) { int a, b; cin >> a >> b; deg[a]++, deg[b]++; uf.unionSet(a, b); } int odd = 0, cnt = 0; for (int i = 0; i < n; i++) if (deg[i]) { odd += deg[i] % 2; cnt += uf.root(i) == i; } cout << (odd <= 2 && cnt == 1 ? "YES" : "NO") << endl; return 0; }