const d = require('fs').readFileSync(0, 'utf8').split(/\s+/); let p = 0; const n = +d[p++], m = +d[p++]; const head = new Int32Array(n + 1).fill(-1); const nxt = new Int32Array(2 * m), to = new Int32Array(2 * m); let ec = 0; for (let i = 0; i < m; i++) { const a = +d[p++], b = +d[p++]; to[ec] = b; nxt[ec] = head[a]; head[a] = ec++; to[ec] = a; nxt[ec] = head[b]; head[b] = ec++; } const color = new Int8Array(n + 1).fill(-1); const q = new Int32Array(n); let ans = 'Yes'; for (let s = 1; s <= n && ans === 'Yes'; s++) { if (color[s] !== -1) continue; color[s] = 0; let qh = 0, qt = 0; q[qt++] = s; while (qh < qt) { const v = q[qh++]; for (let e = head[v]; e !== -1; e = nxt[e]) { const u = to[e]; if (color[u] === -1) { color[u] = color[v] ^ 1; q[qt++] = u; } else if (color[u] === color[v]) { ans = 'No'; qh = qt; break; } } } } console.log(ans);