#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin >> N >> M; vector> G(N,vector(N)); while(M--){ int u,v; cin >> u >> v; G.at(u).at(v) = true; G.at(v).at(u) = true; } bool yes = false; int a,b,c; cin >> a >> b >> c; set S = {a,b,c}; for(int i=0; i now = {i,k}; if(now.size() != 2) continue; if(now == S) continue; //if(G.at(i).at(k) && G.at(k).at(i)) yes = true; } for(int i=0; i now = {i,k,l}; if(now.size() != 3) continue; if(now == S) continue; if(G.at(i).at(k) && G.at(k).at(l) && G.at(l).at(i)) yes = true; } for(int i=0; i now = {i,k,l,m}; if(now.size() != 4) continue; if(now == S) continue; if(G.at(i).at(k) && G.at(k).at(l) && G.at(l).at(m) && G.at(m).at(i)) yes = true; } if(yes) cout << "Yes\n"; else cout << "No\n"; }