#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin >> N >> M; vector> Graph(N); for(int i=0; i> u >> v; u--; v--; Graph.at(u).push_back(v); Graph.at(v).push_back(u); } vector dist(N,-1); vector already(N); bool yes = true; for(int i=0; i Q; Q.push(i); while(Q.size()){ int pos = Q.front(); Q.pop(); already.at(pos) = true; int nd = dist.at(pos)^1; for(auto to : Graph.at(pos)){ if(dist.at(to) == -1){ dist.at(to) = nd; Q.push(to); } else if(dist.at(to) != nd) yes = false; } } } if(yes) cout << "Yes" << endl; else cout << "No" << endl; }