#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; int N, M; void ok(){ puts("YES");exit(0); } int main(){ cin >> N >> M; vector > es(N); vi adj(N), A(M), B(M); rep(i, M){ scanf("%d%d", &A[i], &B[i]); --A[i]; --B[i]; if(A[i] == 0)adj[B[i]] = 1; if(B[i] == 0)adj[A[i]] = 1; } rep(i, M){ if(A[i] * B[i]){ if(adj[A[i]])es[B[i]].insert(A[i]); if(adj[B[i]])es[A[i]].insert(B[i]); } } rep(i, M){ int a = sz(es[A[i]]), b = sz(es[B[i]]); a -= (int)es[A[i]].count(B[i]); b -= (int)es[B[i]].count(A[i]); if(a == 1 && b == 1){ each(u, es[A[i]])if(u != B[i])each(v, es[B[i]])if(v != A[i]){ if(u != v)ok(); } } if(a*b >= 2)ok(); } puts("NO"); }