#include using namespace std; int n, m; vector g[20202]; bitset<20202> path[20202]; // last bool solve() { cin >> n >> m; for (int i = 0; i < m; i++) { int u, v; scanf("%d %d", &u, &v); u--; v--; g[u].push_back(v); g[v].push_back(u); } for (int i : g[0]) { for (int j : g[i]) if (j != 0) { path[j][i] = true; } } for (int i = 0; i < n; i++) { for (int j : g[i]) { if (path[i].count() == 1 && path[j].count() == 1) { if ((path[i] & path[j]).none()) return true; } else if (path[i].count() >= 1 && path[j].count() >= 1) { return true; } } } return false; } int main() { puts(solve() ? "YES" : "NO"); }