import std.stdio; import std.algorithm; import std.typecons; import std.string; import std.array; import std.conv; import std.container; void main() { int N, M; readf("%d %d\n", &N, &M); alias E = Tuple!(int, int); bool[E] es; E[] es1; foreach (i; 0 .. M) { int a, b; readf("%d %d\n", &a, &b); a--; b--; if (a > b) swap(a, b); es1 ~= E(a, b); es[E(a, b)] = true; } bool f(int a, int b) { if (a > b) swap(a, b); return E(a, b) in es ? true : false; } foreach (e; es1) { bool a = false, b = false; int c = 0; for (int i = 1; i < N; i++) { if (i == e[0] || i == e[1]) continue; if (!f(i, 0)) continue; bool flag = false; if (f(e[0], i)) { a = true; flag =true; } if (f(e[1], i)) { b = true; flag = true; } c += flag; } if (c >= 2 && a && b) { writeln("YES"); return; } } writeln("NO"); }