#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; vector v[20005]; int A[50005], B[50005]; int color[20005]; int dp[(1<<4)][20005]; int main(){ ios::sync_with_stdio(false); int N, M; cin >> N >> M; rep(i,M){ cin >> A[i] >> B[i]; v[A[i]].push_back(B[i]); v[B[i]].push_back(A[i]); } bool ret = false; rep(t,200){ rep(i,N+1) color[i] = rand()%4; rep(i,(1<<4)) rep(j,20005) dp[i][j] = 0; rep(i,v[1].size()){ dp[(1<<(color[v[1][i]]))][v[1][i]] = 1; } rep(i,(1<<4)){ rep(j,N+1){ if(dp[i][j] == 1){ rep(k,v[j].size()){ if(v[j][k] == 1) continue; if(i & (1<<(color[v[j][k]])) == 0){ dp[i | (1<<(color[v[j][k]]))][v[j][k]] = 1; } } } } } rep(i,N+1){ if(dp[(1<<4)-1][i] == 1){ rep(j,v[i].size()) if(v[i][j] == 1) ret = true; } } } if(ret) cout << "YES" << endl; else cout << "NO" << endl; return 0; }