#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef pair pii; typedef pair pll; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) #define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i) #define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i) #define DEBUG(x) cout<<#x<<": "< P; int n,m; vector g[25252]; short deg[25252]; int es[52525]; #define SHIFT 16 #define MASK 65535 int main(){ scanf("%d%d",&n,&m); REP(i,n)g[i].assign(n,false); REP(i,m){ int a,b; scanf("%d%d",&a,&b);--a;--b; g[a][b] = g[b][a] = true; es[i] = (a<>SHIFT; b = es[i]&MASK; if(a==0 || b==0)continue; if(deg[a]==1 || deg[b]==1)continue; if(!g[a][0] && !g[b][0])continue; REP(j,i){ c = es[j]>>SHIFT; d = es[j]&MASK; if(c==0 || d==0 || a==c || a==d || b==c || b==d)continue; if(deg[c]==1 || deg[d]==1)continue; if(!g[c][0] && !g[d][0])continue; if(g[a][0]){ if(g[b][c] && g[d][0]){ flag = true; break; }else if(g[b][d] && g[c][0]){ flag = true; break; } } if(g[b][0]){ if(g[a][c] && g[d][0]){ flag = true; break; }else if(g[a][d] && g[c][0]){ flag = true; break; } } } if(flag)break; } puts(flag?"YES":"NO"); return 0; }