const
	maxm = 300;
	maxn = 300;
var
	n, m, i, j, k, oldk, cnt, tm: longint;
	l: array [1..maxm] of longint;
	x: array [1..maxm, 1..maxn] of longint;
begin
	randseed := -1469875599;

	n := 20;
	m := 15;
	for i := 1 to n do begin
		cnt := random(2) + 1;
		oldk := -1;
		for j := 1 to cnt do begin
			repeat
				k := random(m) + 1;
			until k <> oldk;
			oldk := k;
			inc(l[k]);
			x[k][l[k]] := i * (2 * j - 3);
		end;
	end;

	tm := m;
	for i := 1 to m do begin
		if l[i] = 0 then dec(tm);
	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(' ', x[i][j]);
			end;
			writeln;
		end;
	end;
end.