#include #include #include using namespace std; int main(){ int N, M; cin >> N >> M; int trains[M][2]; for(int i = 0; i < M; i++){ cin >> trains[M][0]; cin >> trains[M][1]; } bool if_can_go[N]; bool if_can_use[M]; for(int i = 0; i < N; i++){ if_can_go[i] = false; } for(int i = 1; i < M; i++){ if_can_use[i] = false; } if_can_use[0] = true; if_can_go[trains[0][0]] = true; if_can_go[trains[0][1]] = true; while(true){ bool if_fin = true; for(int i = 0; i < M; i++){ if((if_can_go[trains[i][0]] || if_can_go[trains[i][0]]) && !if_can_use[i]){ if_can_go[trains[i][0]] = true; if_can_go[trains[i][1]] = true; if_can_use[i] = true; if_fin = false; } } if(if_fin){ break; } } for(int i = 0; i < M; i++){ if(!if_can_use[i]){ cout << "NO" << endl; return 0; } } int stop[N]; for(int i = 0; i < N; i++){ stop[i] = 0; } for(int i = 0; i < M; i++){ stop[trains[i][0]]++; stop[trains[i][1]]++; } int count = 0; for(int i = 0; i < N; i++){ count += stop[i] % 2; } if(count <= 2){ cout << "YES" << endl; }else{ cout << "NO" << endl; } }