Type TNum=record
  _1,_2,_3,_4,_5,_6 : integer;
end;
Var
  res : array [1..999] of Tnum;
  num : Tnum;
  curpos : word;
  t : text;
Begin
  for curpos := 0 to 999 do with res[curpos] do
  begin
    _1:=-1;_2:=-1;_3:=-1;_4:=-1;_5:=-1;_6:=-1;
  end;
  curpos := 1;
  with num do begin
  for _1:=0 to 9 do
    for _3:=0 to 9 do
     for _2:=0 to 9 do
      for _4:=0 to 9 do
        for _5:=0 to 9 do
          if _1+_3+_5-_2-_4 in [0..9] then
            begin
              res[curpos] := num;
              res[curpos]._6 :=_1+_3+_5-_2-_4;
              inc(curpos);
            end;
   assign(t,'res.txt');
   rewrite(t);
  for curpos := 1 to 9999 do with res[curpos] do
    if _1 <> -1 then
      begin
       Write(t,_1,_2,_3,_4,_5,_6,' ');
       if curpos mod 10 = 0 then writeln(t,#13);
       
      end;
  end;
  Close(t);
End.