words = list(map(str,input().split()))
score = list(map(int,input().split()))
word = input()
if word == words[0]:
    print(score[0]-1,score[1])
else:
    print(score[0],score[1]-1) words = list(map(str,input().split())) words list(map(str,input().split())) list map(str,input().split()) map str input().split() ().split () input split score = list(map(int,input().split())) score list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split word = input() word input() input if word == words[0]:
    print(score[0]-1,score[1])
else:
    print(score[0],score[1]-1) word == words[0] word words[0] words 0 print(score[0]-1,score[1]) print score[0]-1 score[0] score 0 1 score[1] score 1 print(score[0],score[1]-1) print score[0] score 0 score[1]-1 score[1] score 1 1 word = input() input() word score = list(map(int,input().split())) list(map(int,input().split())) score words = list(map(str,input().split())) list(map(str,input().split())) words
words = list(map(str,input().split()))
score = list(map(int,input().split()))
word = input()
if word == words[0]:
    print(score[0]-1,score[1])
else:
    print(score[0],score[1]-1)