uses for4;
const
 count		= 20;
 len		= 20;
 first_numb	= 12;

var
  DB	     : array [0..count-1] of string;
  INP	     : text;
  k          : integer;


begin
  Assign(INP,'phones.txt');
  {$I-}
    Reset(INP);
    If IOResult <> 0 then
     begin
       WriteLn('File ''phones.txt'' not found');
       Halt(255);
     end;
  {$I+}

  for k := 0 to count-1 do ReadLn(INP,DB[k]);
  Close(INP);

  for k := first_numb+8 downto first_numb do
   if not (k in [first_numb+3,first_numb+6]) then
     SortNum(DB,k,count);

  for k := 0 to count-1 do
    WriteLn(DB[k]);
  WriteLn('End.');
end.
