#include #include #include using namespace std; setvisited; vector>ans; vector>graph; vector>>memo; void dfs(int now){ if(memo[now-1].count(visited))return ; memo[now-1].insert(visited); visited.insert(now); ans[visited.size()].insert(now); for(int i=0;i> N >> M >> K; setst; for(int i=0;i> x; st.insert(x); } if(st.size()==1){ cout << "Yes" << endl; return 0; } for(int i=0;i<=N;i++)ans.push_back({}); for(int i=0;i> a >> b; graph[a-1].push_back(b); graph[b-1].push_back(a); } for(int i=1;i<=N;i++)dfs(i); bool ok=false; for(int i=1;i<=N;i++)if(ans[i]==st)ok=true; if(ok)cout << "Yes" << endl; else cout << "No" << endl; }