S, T = input().split()
A, B = [int(s) for s in input().split()]
U = input()

print(A - (S == U), B - (T == U)) S, T = input().split() S input().split() ().split () input split T int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s A, B = [int(s) for s in input().split()] A [int(s) for s in input().split()] B U = input() U input() input print(A - (S == U), B - (T == U)) print A - (S == U) A S == U S U B - (T == U) B T == U T U U = input() input() U A, B = [int(s) for s in input().split()] [int(s) for s in input().split()] A B = [int(s) for s in input().split()] [int(s) for s in input().split()] B S, T = input().split() input().split() S T = input().split() input().split() T
S, T = input().split()
A, B = [int(s) for s in input().split()]
U = input()

print(A - (S == U), B - (T == U))
