red, blue = input().split()
red_num, blue_num = list(map(int, input().split()))
s = input()

if s == red:
    red_num -= 1
elif s == blue:
    blue_num -= 1

print(str(red_num) + ' ' + str(blue_num)) red, blue = input().split() red input().split() ().split () input split blue red_num, blue_num = list(map(int, input().split())) red_num list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split blue_num s = input() s input() input if s == red:
    red_num -= 1
elif s == blue:
    blue_num -= 1 s == red s red red_num -= 1 red_num 1 elif s == blue:
    blue_num -= 1 s == blue s blue blue_num -= 1 blue_num 1 print(str(red_num) + ' ' + str(blue_num)) print str(red_num) + ' ' + str(blue_num) str(red_num) + ' ' str(red_num) str red_num ' ' str(blue_num) str blue_num blue_num = list(map(int, input().split())) list(map(int, input().split())) blue_num s = input() input() s red_num -= 1 1 red_num red, blue = input().split() input().split() red red_num, blue_num = list(map(int, input().split())) list(map(int, input().split())) red_num blue = input().split() input().split() blue blue_num -= 1 1 blue_num
red, blue = input().split()
red_num, blue_num = list(map(int, input().split()))
s = input()

if s == red:
    red_num -= 1
elif s == blue:
    blue_num -= 1

print(str(red_num) + ' ' + str(blue_num))