#include using namespace std; int A[20000][20000]; int x[20000]; int ret[20000]; void mul(int A[20000][20000], int* x, int n) { for (int i = 0; i < n; i++) { ret[i] = 0; for (int j = 0; j < n; j++) { ret[i] += A[i][j] * x[j]; } } } int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; A[a][b] = 1; A[b][a] = 1; } for (int i = 0; i < n; i++) x[i] = A[0][i]; for (int i = 0; i < 4; i++) { mul(A, x, n); memcpy(ret, x, sizeof(int) * 20000); } if (x[0] == 0) cout << "NO\n"; else cout << "YES\n"; return 0; }