program main
  implicit none

  character ( len = 10 ) :: ss, tt, uu
  integer :: aa, bb

  read *, ss, tt
  read *, aa, bb
  read *, uu

  if ( ss == uu ) then
     aa = aa - 1
  else if ( tt == uu ) then
     bb = bb - 1
  end if

  print *, aa, bb

end program main
