{$O-}
{$apptype console}
var fl,i,j,c,n,x,y,z,b,k:integer;
    a:array[1..60,1..3] of integer;
    flaa:boolean;
begin
  assign(input,'settings.txt');
  assign(output,'input.txt');
  reset(input);
  rewrite(output);
  randomize;
  x:=random(2001)-1000;
  y:=random(2001)-1000;
  z:=random(2001)-1000;
  read(fl);
  if fl=1 then
    read(n,b,k)
  else
  begin
    n:=random(50)+1;
    b:=random(n)+1;
    k:=random(16);
  end;
  writeln(x,' ',y,' ',z,' ',n,' ',b,' ',k);
  a[1][1]:=x;
  a[1][2]:=y;
  a[1][3]:=z;
  i:=2;
  while i<=n+1 do
  begin
    x:=random(2001)-1000;
    y:=random(2001)-1000;
    z:=random(2001)-1000;
    flaa:=false;
    for j:=i-1 downto 1 do
    begin
      if (a[j][1]=x)and(a[j][2]=y)and(a[j][3]=z) then
      begin
        flaa:=true;
        break;
      end;
    end;
    if not flaa then
    begin
      writeln(x,' ',y,' ',z,' ',random(100));
      inc(i);
    end;
  end;
end.