a = [i for i in input().split()]
nums = [int(i) for i in input().split()]
thr = input()
if(thr == a[0]):
	nums[0] -= 1
else:
	nums[1] -= 1
print(nums[0],nums[1]) i for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() i a = [i for i in input().split()] a [i for i in input().split()] 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 nums = [int(i) for i in input().split()] nums [int(i) for i in input().split()] thr = input() thr input() input if(thr == a[0]):
	nums[0] -= 1
else:
	nums[1] -= 1 thr == a[0] thr a[0] a 0 nums[0] -= 1 nums[0] nums 0 1 nums[1] -= 1 nums[1] nums 1 1 print(nums[0],nums[1]) print nums[0] nums 0 nums[1] nums 1 nums = [int(i) for i in input().split()] [int(i) for i in input().split()] nums thr = input() input() thr a = [i for i in input().split()] [i for i in input().split()] a
a = [i for i in input().split()]
nums = [int(i) for i in input().split()]
thr = input()
if(thr == a[0]):
	nums[0] -= 1
else:
	nums[1] -= 1
print(nums[0],nums[1])