s, t = [i for i in input().split()]
a, b = [int(i) for i in input().split()]
u = input()
if u == s:
	a -= 1
else:
	b -= 1
print("%d %d" % (a, 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 int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a, b = [int(i) for i in input().split()] a [int(i) for i in input().split()] b u = input() u input() input if u == s:
	a -= 1
else:
	b -= 1 u == s u s a -= 1 a 1 b -= 1 b 1 print("%d %d" % (a, b)) print "%d %d" % (a, b) "%d %d" (a, b) a b b -= 1 1 b t = [i for i in input().split()] [i for i in input().split()] t u = input() input() u a -= 1 1 a s, t = [i for i in input().split()] [i for i in input().split()] s b = [int(i) for i in input().split()] [int(i) for i in input().split()] b a, b = [int(i) for i in input().split()] [int(i) for i in input().split()] a
s, t = [i for i in input().split()]
a, b = [int(i) for i in input().split()]
u = input()
if u == s:
	a -= 1
else:
	b -= 1
print("%d %d" % (a, b))