program main
	implicit none
    character(10)::s,t,u
    integer::a,b
    read(*,*) s,t
    read(*,*)a,b
    read(*,*)u
    
    if(s==t)then
    	write(*,*) a-1,b
    else
    	write(*,*) a,b-1
    end if
    stop
end program main