Public Class Main
    Public Shared Sub Main(ByVal args() As String)

        Dim tmp() As String
        tmp = Split(Console.ReadLine())
        Dim S, T, U As String
        Dim a, b As Integer
        S = tmp(0) : T = tmp(1)
        tmp = Split(Console.ReadLine())
        a = tmp(0) : b = tmp(1)
        U = Console.ReadLine()

        If U.Contains(S) Then
            a -= 1
        Else
            b -= 1
        End If

        Console.WriteLine(a.ToString & " " & b.ToString)

    End Sub
End Class
