#define I for(i=2*m;i--;) i,a[1<<17],b[1<<17],c[20000],d[20000],e,f;main(m){scanf("%*d%d",&m);I scanf("%d%d",a+i,b+i),b[i-1]=a[i],a[i-1]=b[i--];I c[--b[i]]|=!--a[i];I if(c[b[i]]*a[i])d[a[i]]=d[a[i]]?--f:b[i];I e|=d[a[i]]&&d[b[i]]&&d[a[i]]-b[i]&&d[b[i]]-a[i]&&d[a[i]]-d[b[i]];i=!puts(e?"YES":"NO");}