#include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long int #define ti4 tuple #define pii pair static const int MAX_N = 100000; vector g[MAX_N]; struct hist { int c; int v[5]; bool ok(int n) { if(c != 5) { return false; } if(n == 1) { return true; } return false; } bool can(int n) { if(c >= 5) { return false; } for(int i = 0;i < c;i++) { if(v[i] == n) { return false; } } return true; } int last() const { return v[c-1]; } hist add(int n) { hist next = *this; next.v[next.c] = n; next.c++; return next; } }; int main() { int n,m; cin >> n >> m; for(int i = 0;i < m;i++) { int f, s; cin >> f >> s; g[f].push_back(s); g[s].push_back(f); } queue q; q.push({1, 1}); while(!q.empty()) { auto s = q.front(); q.pop(); for(auto& r : g[s.last()]) { if(s.ok(r)) { cout << "YES" << endl; return 0; } if(!s.can(r)) { continue; } q.push(s.add(r)); } } cout << "NO" << endl; return 0; }