#include #include #include using namespace std; const int INF = 1e3 + 5; vector visited(INF,false); vector color(INF,-1); bool bfs(int u,vector> &adj) { queue q; q.push(u); visited[u] = true; color[u] = 0; while(!q.empty()) { int s = q.front(); q.pop(); for(int v:adj[s]) { if(!visited[v] && color[v] == -1) { q.push(v); visited[v] = true; color[v] = color[s] ? 0: 1; } if(color[u] == color[v]) { return 0; } } } return 1; } int main() { int n,e; cin>>n>>e; vector> adj(n+1); while(e--) { int u,v; cin>>u>>v; adj[u].push_back(v); } bool result = bfs(2,adj); if (result) cout << "Yes\n"; else cout << "No\n"; return 0; }