program test01
 implicit none
 character(len=10) S, T, U
 integer A, B

 read *, S, T
 read *, A, B
 read *, U

 S=trim(S)
 T=trim(T)
 U=trim(U)
 if ( U == S ) A=A-1
 if ( U == T ) B=B-1

 print '(i0,1x,i0)', A, B

endprogram test01
