import numpy

S, T = map(str, input().split())
AB = list(map(int, input().split()))
U = input()

if U == S:
    tmp = numpy.array([1,0])
else:
    tmp = numpy.array([0,1])
print(numpy.array(AB-tmp)[0], numpy.array(AB-tmp)[1]) import numpy numpy S, T = map(str, input().split()) S map(str, input().split()) map str input().split() ().split () input split T AB = list(map(int, input().split())) AB list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split U = input() U input() input if U == S:
    tmp = numpy.array([1,0])
else:
    tmp = numpy.array([0,1]) U == S U S tmp = numpy.array([1,0]) tmp numpy.array([1,0]) numpy.array numpy array [1,0] 1 0 tmp = numpy.array([0,1]) tmp numpy.array([0,1]) numpy.array numpy array [0,1] 0 1 print(numpy.array(AB-tmp)[0], numpy.array(AB-tmp)[1]) print numpy.array(AB-tmp)[0] numpy.array(AB-tmp) numpy.array numpy array AB-tmp AB tmp 0 numpy.array(AB-tmp)[1] numpy.array(AB-tmp) numpy.array numpy array AB-tmp AB tmp 1 AB = list(map(int, input().split())) list(map(int, input().split())) AB T = map(str, input().split()) map(str, input().split()) T tmp = numpy.array([0,1]) numpy.array([0,1]) tmp tmp = numpy.array([1,0]) numpy.array([1,0]) tmp S, T = map(str, input().split()) map(str, input().split()) S U = input() input() U
import numpy

S, T = map(str, input().split())
AB = list(map(int, input().split()))
U = input()

if U == S:
    tmp = numpy.array([1,0])
else:
    tmp = numpy.array([0,1])
print(numpy.array(AB-tmp)[0], numpy.array(AB-tmp)[1])