Const
  S1=12;
  S2=12;
  L=2;
Var
  Was:Array[1..S1*S2]Of Boolean;
  A:Byte;
  I,J:Byte;
Begin
  Randomize;
  Assign(Output,'walls.in');
  ReWrite(Output);
  WriteLn((S1-1)*(S2-1)+1);
  WriteLn(S1*S2);
  WriteLn(L);
  FillChar(Was,SizeOf(Was),False);
  For I:=1 To L Do Begin
    Repeat
      A:=Random(S1*S2)+1;
    Until Not Was[A];
    Was[A]:=True;
  End;
  For I:=1 To S1*S2 Do If Was[I] Then Write(' ',I);
  WriteLn;
  For I:=1 To (S1-1) Do
    For J:=1 To (S2-1) Do Begin
      WriteLn(4);
      WriteLn((J-1)*S1+I,' ',(J-1)*S1+I+1,' ',J*S1+I+1,' ',J*S1+I);
    End;
  WriteLn(S1*2+S2*2-4);
  For I:=1 To S1-1 Do Write(' ',(S2-1)*S1+I);
  For I:=S2 DownTo 2 Do Write(' ',I*S1);
  For I:=S1 DownTo 2 Do Write(' ',I);
  For I:=1 To S2-1 Do Write(' ',(I-1)*S1+1);
  WriteLn;
  Close(Output);
End.