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