program fjf173;
var
  a:file of char;
  b:text;
  c,d:string(10);
  e:char;
begin
  rewrite(a,'test.dat');
  a^:='O';
  put(a);
  write(a,'K');
  close(a);
  extend(b,'test.dat'); { An implicit EOLN is appended, according to the standard. } 
  b^:='O';
  put(b);
  write(b,'K');
  reset(b);
  readln(b,c);
  readln(b,d);
  {$i-}
  read(b,e);
  {$i+}
  if IOResult = 0 then
    begin
      writeln ('Failed: read past EOF was not recognized.');
      halt (1)
    end;
  close(b);
  if c=d then writeln(c) else writeln('Failed')
end.
