#include using namespace std; bool dp[6][20001]; vector adj[20001]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n, m, a, b; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a >> b; adj[a].push_back(b); adj[b].push_back(a); } for (int i = 1; i <= 1; i++) { memset(dp, false, sizeof(dp)); dp[0][i] = true; for (int j = 0; j < 5; j++) { for (int k = 1; k <= n; k++) { if (dp[j][k] == false) continue; for (auto u : adj[k]) { dp[j + 1][u] = true; } } } if (dp[5][i]) { cout << "YES" << '\n'; return 0; } } cout << "NO" << '\n'; return 0; }