program main
    implicit none
    integer(4):: a,b
    character(10):: s,t,u
    read*, s,t
    read*, a,b
    read*, u

    if (u == s) then
        a=a-1
    else
        b=b-1
    end if

    print"(i0,1x,i0)",a,b
end program main