#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pint; typedef vector vint; typedef vector vpint; #define mp make_pair #define fi first #define se second #define all(v) (v).begin(),(v).end() #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) int n, m; vector g[20010]; bool memo[20010][20010]; int main(void){ cin >> n >> m; rep(i, m){ int a, b; cin >> a >> b; a--; b--; g[a].push_back(b); g[b].push_back(a); memo[a][b] = memo[b][a] = true; } //1 - u - vとなるような辺を見つける vector > d; for(int u : g[0]){ for (int v : g[u]){ //頂点に戻るようなものは入れない if(v != 0) d.push_back(make_pair(u, v)); } } for (int i = 0; i < d.size() - 1; ++i){ for (int j = i + 1; j < d.size(); ++j){ if(d[i].first != d[j].first && d[i].first != d[j].second && d[i].second != d[j].first && d[i].second != d[j].second){ /* for (int tmp : g[d[i].second]){ if(tmp == d[j].second){ printf("YES\n"); return 0; } } */ if(memo[d[i].second][d[j].second]){ printf("YES\n"); return 0; } } } } printf("NO\n"); return 0; }