var
  outfile, ansfile: text;
  a, b, n: integer;
  ok: boolean;
  s, t:string;
begin
  assign(outfile, paramStr(2));
  assign(ansfile, paramStr(3));
  reset(outfile);
  reset(ansfile);
  readln(outfile, a);
  readln(ansfile, b);
  ok:=a=b;
  n:=0;
  while ok and (n<a) do
    begin
      readln(outfile, s);
      readln(ansfile, t);
      ok:=s=t;
      inc(n)
    end;
  if ok then
    writeln(10)
  else
    writeln(0);
  close(outfile);
  close(ansfile);
end.

