#include #include #include #include #include #define INF 1<<30 using namespace std; bool Ans = false; int N, M; void dfs(vector> v,int prev,int next,int n) { //cout << "next = " << next << " n = " << n << endl; if (n == N) { return ; } for (int i = 0; i < v[next].size();i++) { int f = v[next][i]; if (f == 1 && n + 1 == N) { Ans = true; } if (f != 1 && f != prev) dfs(v,next, f, n + 1); } return ; } int main() { cin.tie(0);ios::sync_with_stdio(false); cin >> N >> M; vector< vector> v(N + 1); for (int i = 0; i < M;i++) { int a, b; cin >> a >> b; v[a].push_back(b); v[b].push_back(a); } dfs(v,0, 1, 0); if (Ans) { cout << "YES"; } else { cout << "NO"; } cout << endl; return 0; }