S, T = [i for i in input().split()]
A, B = map(int, input().split())
U = input()
if U == S:
    A -= 1
elif U == T:
    B -= 1
print(str(A) + " " + str(B)) i for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() i S, T = [i for i in input().split()] S [i for i in input().split()] T A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B U = input() U input() input if U == S:
    A -= 1
elif U == T:
    B -= 1 U == S U S A -= 1 A 1 elif U == T:
    B -= 1 U == T U T B -= 1 B 1 print(str(A) + " " + str(B)) print str(A) + " " + str(B) str(A) + " " str(A) str A " " str(B) str B B = map(int, input().split()) map(int, input().split()) B U = input() input() U S, T = [i for i in input().split()] [i for i in input().split()] S T = [i for i in input().split()] [i for i in input().split()] T B -= 1 1 B A, B = map(int, input().split()) map(int, input().split()) A A -= 1 1 A
S, T = [i for i in input().split()]
A, B = map(int, input().split())
U = input()
if U == S:
    A -= 1
elif U == T:
    B -= 1
print(str(A) + " " + str(B))
