#include using namespace std; #define REP(i,n) for(int i=0;i ostream& operator<<(ostream& os,const vector& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; } typedef long long ll; typedef unsigned long long ull; typedef pair pii; typedef vector vi; typedef vector vvi; int N,M; vector A,B; vector> G; vector> S; int main(){ cin>>N>>M; G.resize(N); S.resize(N); rep(i,M){ int a,b;cin>>a>>b; a--,b--; A.PB(a); B.PB(b); G[a].PB(b); G[b].PB(a); } for(int u:G[0]){ for(int v:G[u]){ if(v==0 or u==0) continue; S[v].insert(u); } } rep(i,M){ int a=A[i],b=B[i]; if(a==b or a==0 or b==0) continue; for(int u1 : S[a]){ for(int u2 : S[b]){ if(u1!=0 and u1!=b and u2!=0 and u2!=a and u1!=u2){ cout << "YES" << endl; return 0; } } } } cout << "NO" << endl; }