{$APPTYPE CONSOLE}
uses
  SysUtils;

var
  f: TextFile;
  i, j, N: Integer;
begin
  AssignFile(f, 'input.txt'); Rewrite(f);
  N := StrToIntDef(ParamStr(1), 10);
  Writeln(f, N, ' ', N);
  RandSeed := StrToIntDef(ParamStr(2), 101);
  for i := 1 to N do
    for j := 1 to N do
      Write(f, Random(N) + 1, ' ');
  CloseFile(f);
end.
