Imports System

Module Program
    Sub Main(args As String())
        Dim tmpA As String() = Split(Console.ReadLine(), " ")
        Dim tmpB As String() = Split(Console.ReadLine(), " ")
        Dim StringU As String = Console.ReadLine()

        Dim StringS As String = tmpA(0)
        Dim StringT As String = tmpA(1)
        Dim IntA As Integer = CInt(tmpB(0))
        Dim IntB As Integer = CInt(tmpB(1))

        If StringU = StringS Then
            IntA = IntA - 1
        Else
            IntB = IntB - 1
        End If

        Console.WriteLine(IntA & " " & IntB)

    End Sub
End Module
