label
	restart;
const
	maxm = 300;
	maxn = 300;
var
	n, m, i, j, k, q, cnt, tm: longint;
	l: array [1..maxm] of longint;
	u: array [1..maxm] of boolean;
	x: array [1..maxm, 1..maxn] of longint;
	pe: array [-maxn..maxn] of longint;
	p: longint;
	z: longint;
begin
	randseed := 388630259;

	n := 300 - random(50);
	m := n - random(50);

	p := 3;


restart:
	fillchar(l, sizeof(l), 0);
	fillchar(u, sizeof(u), 0);
	for i := 1 to m do begin
		if random(100) < p then
			cnt := 1
		else
			cnt := 2;

		repeat
			k := random(m) + 1;
		until not u[k] or (random(10) = 0);
		repeat
			q := random(m) + 1;
		until (k <> q) and (l[q] < 5);
		inc(l[k]);
		if (cnt > 1) then
			inc(l[q]);
		if random(2) = 0 then begin
			x[k][l[k]] := i;
			if (cnt > 1) then
				x[q][l[q]] := -i;
		end else begin
			x[k][l[k]] := -i;
			if (cnt > 1) then
				x[q][l[q]] := i;
		end;
		u[k] := true;
	end;
	for i := m + 1 to n do begin
		cnt := 1;
		k := random(m) + 1;
		inc(l[k]);
		x[k][l[k]] := i * (2 * random(2) - 1);
	end;

	tm := m;
	z := 0;
	for i := 1 to m do begin
		if l[i] = 0 then dec(tm);
		if l[i] = 1 then begin
			inc(z);
			if (z > m div 4) then
				goto restart;
		end;
	end;

	for i := 1 to n do begin
		j := random(i) + 1;
		pe[i] := pe[j];
		pe[j] := i;
	end;

	for i := -1 downto -n do begin
		pe[i] := -pe[-i];
	end;

	writeln(n, ' ', tm);
	for i := 1 to m do begin
		if (l[i] > 0) then begin
			write(l[i]);
			for j := 1 to l[i] do begin
				write(' ', pe[x[i][j]]);
			end;
			writeln;
		end;
	end;
end.