{-------------------------------
  Ferz'.
 -------------------------------
  # Max Tkachenko # Group 112 #
 -------------------------------
}

Program task_13_10(input,output);
 type
   pole = record
    vert : (a,b,c,d,e,f,g,h);
    horz : 1..8;
   end;

 function canmove (n1, n2 : pole):boolean;
  begin

   canmove := (n1.vert = n2.vert) or
              (n1.horz = n2.horz) or
              (ord(n2.vert)-ord(n1.vert) = n2.horz-n1.horz) or
              (ord(n1.vert)-ord(n2.vert) = n2.horz-n1.horz)

  end;


 var
  n1, n2 : pole;

 begin
  n1.vert := c;
  n1.horz := 1;

  n2.vert := a;
  n2.horz := 3;

  writeln(canmove(n1,n2));
  readln;
 end.