Imports System
Module ABC154A
	Sub Main()
		Dim s,t,u As String
		Dim a,b As Integer
		Dim inputs() As String
		
		inputs = Console.ReadLine().Split()
		s = inputs(0)
		t = inputs(1)
		inputs = Console.ReadLine().Split()
		a = Integer.Parse(inputs(0))
		b = Integer.Parse(inputs(1))
		u = Console.ReadLine()
		If u = s
			a -= 1
		Else
			b -= 1
		End If
		Console.WriteLine("{0} {1}",a,b)
	End Sub
End Module
