import core.bitop; import std.algorithm; import std.array; import std.ascii; import std.container; import std.conv; import std.format; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; void main() { auto v = readln.chomp.split.map!(to!int); int n = v.front; int m = v.back; alias A = Tuple!(int, "to", int, "idx"); auto adj = new A[][](n); A tekito; foreach (i; 0..m) { auto s = readln.chomp.split.map!(to!int); int a = s.front; int b = s.back; adj[a] ~= A(b, i); adj[b] ~= A(a, i); tekito = adj[b].back; } bool[] done = new bool[](m); int[] list = [tekito.to]; int[] queue = [tekito.to]; while (queue.length) { int node = queue.front; queue = queue[1..$]; foreach (next; adj[node]) { if (done[next.idx]) { continue; } done[next.idx] = true; list ~= next.to; queue ~= next.to; } } auto cnt = adj.map!(a => a.length).filter!(a => a % 2 == 1).count; stderr.writeln = cnt; stderr.writeln = done; bool ans = !done.any!(a => !a) && (cnt == 0 || cnt == 2); enum R = ["NO", "YES"]; R[ans].writeln; }