#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; // change!!!!!!!!!!!! #define MAX_N 500 int uf_par[MAX_N]; int uf_rank[MAX_N]; void uf_init( int n ) { for ( int i = 0; i < n; i++ ) { uf_par[i] = i; uf_rank[i] = 0; } } int uf_find( int x ) { if ( uf_par[x] == x ) { return x; } else { return uf_par[x] = uf_find(uf_par[x]); } } void uf_unite( int x, int y ) { x = uf_find( x ); y = uf_find( y ); if ( x == y ) { return; } if ( uf_rank[x] < uf_rank[y] ) { uf_par[x] = y; } else { uf_par[y] = x; if ( uf_rank[x] == uf_rank[y] ) { uf_rank[x]++; } } } bool uf_same( int x, int y ) { return uf_find(x) == uf_find(y); } int main() { int N,M; cin >> N >> M; vector< vector > P(N); uf_init(N); for ( int i = 0; i < M; i++ ) { int a,b; cin >> a >> b; P[a].push_back(b); P[b].push_back(a); uf_unite(a,b); } bool ans = true; int a = INT_MAX; for ( int i = 0; i < N; i++ ) { if ( uf_find(i) != i ) { if ( a != INT_MAX && a != uf_find(i) ) { ans = false; break; } a = uf_find(i); } } int b = 0; for ( int i = 0; i < N; i++ ) { if ( P[i].size()%2 ) { b++; } } if ( !( b == 0 || b == 2 ) ) { ans = false; } cout << ( ans ? "YES" : "NO" ) << endl; return 0; }