#include //#include using namespace std; //using namespace atcoder; //python3 expander.py main.cpp using ll = long long; using ld = long double; using lll = __int128_t; //using mint = modint; //mint::set_mod(M); //using mint = modint998244353; //using mint = modint1000000007; template using pq = priority_queue; //大きい順 template using pq_g = priority_queue, greater>; //小さい順 #define vec_unique(v) v.erase(unique(v.begin(), v.end()), v.end()) //重複削除 #define vec_iota(v) iota(v.begin(), v.end(), 0) //0, 1, 2, 3, ..., n - 1にセット #define concat(a, b) a.insert(a.end(), b.begin(), b.end()) #define debug(x) cerr << #x << " = " << x << endl #define maxvalue(array) *max_element(array.begin(), array.end()) #define minvalue(array) *min_element(array.begin(), array.end()) #define sumvalue(array) accumulate(array.begin(), array.end(), 0ll) #define popcount(x) __builtin_popcountll(x) int dx[4] = {1, -1, 0, 0}; int dy[4] = {0, 0, 1, -1}; //int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1}; //int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1}; #define INF 2e18 #define INF2 2e9 // std::uniform_int_distributionを利用した一様乱数生成クラス class Random_Gen{ random_device seed_gen; mt19937 engine; uniform_int_distribution dist; public: // Constructor [l,r]で生成する値の範囲を指定 Random_Gen() : engine(seed_gen()) {} Random_Gen(int64_t l, int64_t r) : engine(seed_gen()), dist(l,r) {} // 現在の生成する値の範囲をstd::pairで返す pair get_range(){ return make_pair(dist.min(),dist.max()); } // 生成する値の範囲を[l,r]に変更する void set_range(int64_t l, int64_t r){ uniform_int_distribution::param_type Param(l,r); dist.param(Param); } // [l,r]内の一様分布の整数を返す int64_t gen(){ return dist(engine); } int64_t operator()(){ return gen(); } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector> graph(n); vector> bs(500); for(int i = 0; i < m; i++) { int u, v; cin >> u >> v; u--; v--; graph[u].push_back(v); graph[v].push_back(u); } Random_Gen Random(0, 4); auto f = [&]() -> bool { vector color(n); for(int i = 0; i < n; i++) color[i] = Random.gen(); vector> dp((1 << 5), vector(n)); dp[(1 << color[0])][0] = true; for(int i = 0; i < (1 << 5); i++) { for(int j = 0; j < n; j++) { if(!dp[i][j]) continue; for(auto next_v : graph[j]) { int c = color[next_v]; if(!(i & (1 << c))) { dp[i | (1 << c)][next_v] = true; } } } } for(int i = 0; i < n; i++) { if(dp[(1 << 5) - 1][i]) { for(auto next_v : graph[i]) { if(next_v == 0) return true; } } } return false; }; for(int iter = 0; iter < 200; iter++) { if(f()) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; //cout << fixed << setprecision(15) << << endl; return 0; }