uses
	testlib, SysUtils;

type StringArray = array [1..6] of String;

var
  an, ou : StringArray;
  na, no, i : integer;

procedure Sort(var s : StringArray; size : integer);
var i, j : integer;
    p : String;
begin
  for i := 1 to size do begin
    for j := i + 1 to size do begin
      if (s[i] > s[j]) then begin
        p := s[i];
        s[i] := s[j];
        s[j] := p;
      end;
    end;
  end;
end;

begin
  na := 0;
  while (not ans.seekeof) do begin
    na := na + 1;
    an[na] := ans.ReadString;
  end;

  no := 0;       
  while (not ouf.seekeof) do begin
    no := no + 1;
    ou[no] := ouf.readString;
    if (no > na) then
   	    quit(_wa, 'Wrong number of lines');
  end;      

  if (na <> no) then 
  	quit(_wa, 'Wrong number of lines');


  Sort(an, na);
  Sort(ou, no);

  for i := 1 to na do begin
    if (an[i] <> ou[i]) then quit(_wa, 'Wrong dates');
  end;

  quit(_ok, 'OK! ' + IntToStr(no) + ' lines');
end.
