#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair(a,b) #define pb(a) push_back(a) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="< P; vector g[N]; vector len2[N]; P edg[M]; int main(){ int n,m; cin>>n>>m; rep(i,m){ int a,b; scanf("%d %d", &a, &b); a--;b--; g[a].pb(b); g[b].pb(a); edg[i]=mp(a,b); } rep(i, g[0].size()){ int mid = g[0][i]; rep(j, g[mid].size()){ int tgt = g[mid][j]; // 0->mid->tgt if(tgt==0) continue; len2[tgt].pb(mid); } } rep(i, m){ int a = edg[i].fi, b = edg[i].se; if(len2[a].size()>=3 && len2[b].size()>=3){ cout<<"YES"<