#include using namespace std; using ll = long long; unsigned long long xor64(){ static unsigned long long x = 88172645463325252LL; x ^= (x << 13); x ^= (x >> 7); return (x ^= (x << 17)); } //頂点数Lの単純パスを見つける bool color_coding(vector> &g, int L){ int n = g.size(); vector a(n); vector> dp(1 << L, vector(n)); for(int i = 0; i < n; i++){ a[i] = 1 << (xor64() % L); } for(auto &&u:g[0]) dp[a[u]][u] = true; for(int S = 1; S < (1 << L); S++){ for(int v = 1; v < n; v++){ if(!dp[S][v])continue; for(auto &&u:g[v]){ if(!u || (S & a[u]))continue; dp[S | a[u]][u] = true; } } } for(auto &&u:g[0]) if(dp.back()[u])return true; return false; } int main(){ ios::sync_with_stdio(false); cin.tie(0); clock_t finish = clock() + CLOCKS_PER_SEC / 1000 * 960; int n, m, u, v; cin >> n >> m; vector> g(n); for(int i = 0; i < m; i++){ cin >> u >> v; g[--u].push_back(--v); g[v].push_back(u); } while(clock() <= finish){ if(color_coding(g, 4)){ cout << "YES" << '\n'; return 0; } } cout << "NO" << '\n'; }