module ABC154A
  sub Main(ByVal args() as String)
    Dim S as String
    Dim T as String
    dim arr(2) as string
    arr=Split(Console.ReadLine())
    S = arr(0)
    T = arr(1)
    
    Dim A as Long
    Dim B as Long
    dim arr2(2) as string
    arr2=Split(Console.ReadLine())
    A = arr2(0)
    B = arr2(1)
    
    Dim U as String
    U = Console.ReadLine()
    
    If U = S Then
        A = A-1
    Else
        B = B-1
    End If

    Console.WriteLine("{0} {1}", A, B)
  end sub
end module
