module A
  sub main(byval args() as string)
    dim s,t,u,arr() as string
    dim a,b as integer
    arr=split(console.readline())
    s=arr(0):t=arr(1)
    arr=split(console.readline())
    a=arr(0):b=arr(1)
    u=console.readline()
    console.writeline(if(u=s, _
          (a-1) & " " & b , _
          a  & " " & (b-1) ))
  end sub
end module