S, T = input().split()
A, B = input().split()
A = int(A)
B = int(B)
U = input()
if U == S:
    A = A - 1
    print(A, B)
elif U == T:
    B = B - 1
    print(A, B)

bf42232e1443ff6389a812c66525cfe7b7c83752
<mask token>

<mask token>
if U == S:
    A = A - 1
    print(A, B)
elif U == T:
    B = B - 1
    print(A, B)

S, T = input().split()
A, B = input().split()
A = int(A)
B = int(B)
U = input()
if U == S:
    A = A - 1
    print(A, B)
elif U == T:
    B = B - 1
    print(A, B)
