#include #include #include #include #include #include using namespace std; using ll = long long int; using P = tuple; static const int NUM = 1000; int N, M; vector> adjacency_list(NUM); set passed; bool dfs(int p, int num) { for (auto&& a: adjacency_list[p]) { int key = (p > a)? NUM * a + p: NUM * p + a; if (passed.find(key) != passed.end()) continue; passed.insert(key); if (dfs(a, num+1)) return true; passed.erase(key); } return num == M; } int main() { cin >> N >> M; for (int i = 0; i < M; ++i) { int Sa, Sb; cin >> Sa >> Sb; adjacency_list[Sa].push_back(Sb); adjacency_list[Sb].push_back(Sa); } for (int i = 0; i < N; ++i) { if (dfs(i, 0)) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }