#!/usr/bin/env python3
"""
Produces NO instances that yesno_wrong (after the off-by-one fix) still
accepts as YES because it doesn't verify the missing pizzas.

Construction (M >= 2, N >= 2*M + 1):
  Stack 0:       [0,   M]
  Stack i:       [i,   M + i]    for 1 <= i <= M-2
  Stack M-1:     [M-1, N-1]

Sorted by bottom, the tops are M, M+1, ..., 2M-2, N-1 — non-decreasing,
each stack increasing, and the largest-bottom stack tops out at N-1.
yesno_wrong therefore prints "Yes".

But ranks {2M-1, ..., N-2} are unplaced and all exceed the smallest
stack top M. A baker with such a rank cannot walk (some table holds
a rank smaller than theirs when they arrive) yet has no legal landing
spot in the recorded stacks — so the instance is actually NO.
"""

import sys, random


def cmdlinearg(name, default=None):
    for arg in sys.argv:
        if arg.startswith(name + "="):
            return arg.split("=")[1]
    assert default is not None, name
    return default


random.seed(int(cmdlinearg("seed", sys.argv[-1])))

MAXN = int(sys.argv[1])
MAXM = int(sys.argv[2])
N = int(cmdlinearg("N", MAXN))
M = int(cmdlinearg("M", min(MAXM, max(2, N // 2 - 1))))

assert M >= 2, f"need M >= 2, got M={M}"
assert N >= 2 * M + 1, f"need N >= 2M+1, got N={N} M={M}"

S = M
stacks = [[0, S]]
for i in range(1, M - 1):
    stacks.append([i, S + i])
stacks.append([M - 1, N - 1])

random.shuffle(stacks)

print(N, M)
for s in stacks:
    print(len(s), *s)
