#include using namespace std; int main(){ int n, m, u, v; cin >> n >> m; vector> g(n); vector> edge(m); for(int i = 0; i < m; i++){ cin >> u >> v; edge[i] = {--u, -- v}; g[u].push_back(v); g[v].push_back(u); } vector used(n), val(n); for(auto &&u:g[0]){ val[u] = rand(); for(auto &&v:g[u]){ used[v] += val[u]; } } used[0] = 0; for(int i = 0; i < m; i++){ tie(u, v) = edge[i]; if(used[u] && used[v] && g[u].size() >= 2 && g[v].size() >= 2 && (used[u] + used[v] != val[u] + val[v])){ cout << "YES" << '\n'; return 0; } } cout << "NO" << '\n'; }