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