import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


s,t = input().split()
a,b = map(int, input().split())
u = input()
if s==u:
    a -= 1
else:
    b -= 1
print(" ".join(map(str, (a,b)))) import sys sys input = lambda : sys.stdin.readline().rstrip() input lambda : sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip sys.setrecursionlimit(max(1000, 10**9)) sys.setrecursionlimit sys setrecursionlimit max(1000, 10**9) max 1000 10**9 10 9 write = lambda x: sys.stdout.write(x+"\n") write lambda x: sys.stdout.write(x+"\n") sys.stdout.write(x+"\n") sys.stdout.write sys.stdout sys stdout write x+"\n" x "\n" x s,t = input().split() s input().split() ().split () input split t a,b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b u = input() u input() input if s==u:
    a -= 1
else:
    b -= 1 s==u s u a -= 1 a 1 b -= 1 b 1 print(" ".join(map(str, (a,b)))) print " ".join(map(str, (a,b))) " ".join " " join map(str, (a,b)) map str (a,b) a b t = input().split() input().split() t b = map(int, input().split()) map(int, input().split()) b input = lambda : sys.stdin.readline().rstrip() lambda : sys.stdin.readline().rstrip() input u = input() input() u write = lambda x: sys.stdout.write(x+"\n") lambda x: sys.stdout.write(x+"\n") write a,b = map(int, input().split()) map(int, input().split()) a a -= 1 1 a s,t = input().split() input().split() s b -= 1 1 b
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


s,t = input().split()
a,b = map(int, input().split())
u = input()
if s==u:
    a -= 1
else:
    b -= 1
print(" ".join(map(str, (a,b))))