#include #include #include #include #include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repd(i,0,n) #define all(x) (x).begin(),(x).end() #define mod 1000000007 #define inf 2000000007 #define mp make_pair #define pb push_back typedef long long ll; using namespace std; template inline void output(T a, int p) { if(p) cout << fixed << setprecision(p) << a << "\n"; else cout << a << "\n"; } // end of template int main() { cin.tie(0); ios::sync_with_stdio(0); // source code int N, M; cin >> N >> M; vector> G(N); vector H(N); rep(i, M){ int a, b; cin >> a >> b; a--, b--; G[a].pb(b); G[b].pb(a); } vector P(N, 0); for(int v: G[0]){ P[v] = 1; } for(int i = 1; i < N; i++){ for(int j: G[i]){ for(int k: G[i]){ if(k == j || k == 0) continue; for(int l: G[j]){ if(l == i || l == 0) continue; if(P[k] && P[l]){ output("YES", 0); return 0; } } } } } output("NO", 0); return 0; }