#include using namespace std; #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) using ll = long long; using P = std::tuple; const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1}; int N, M; vector G[20000]; bool used[20000]; int can(int u, int n){ bool f = false; for(int v : G[u]){ if(v == 0 && n == 5){return true;} if(!used[v]){ used[v] = true; // std::cout << "-> " << v << std::endl; f = f || can(v, n + 1); } } return f; } int main(){ //* std::cin.tie(nullptr); std::ios::sync_with_stdio(false); /*/ /*/ std::cin >> N >> M; for(int i=0;i> A >> B; --A; --B; G[A].emplace_back(B); G[B].emplace_back(A); } used[0] = true; bool f = can(0, 1); if(f){ std::cout << "YES" << std::endl; }else{ std::cout << "NO" << std::endl; } }