! 2020.2.9
!
      program answer
      implicit none
      character(len=10) :: S,T,U
      integer :: A,B
!
      read(*,*) S,T
      read(*,*) A,B
      read(*,*) U
!
      if(S == U) A = A-1
      if(T == U) B = B-1
      write(*,*) A,B
      end program answer