S,T = input().split()
A,B = (int(x) for x in input().split())
U = input()
if U == S:
    A -= 1
    print(('{} {}'.format(A,B)))
else:
    B -= 1
    print(('{} {}'.format(A,B))) S,T = input().split() S input().split() ().split () input split T int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A,B = (int(x) for x in input().split()) A (int(x) for x in input().split()) B U = input() U input() input if U == S:
    A -= 1
    print(('{} {}'.format(A,B)))
else:
    B -= 1
    print(('{} {}'.format(A,B))) U == S U S A -= 1 A 1 print(('{} {}'.format(A,B))) print '{} {}'.format(A,B) '{} {}'.format '{} {}' format A B B -= 1 B 1 print(('{} {}'.format(A,B))) print '{} {}'.format(A,B) '{} {}'.format '{} {}' format A B U = input() input() U B = (int(x) for x in input().split()) (int(x) for x in input().split()) B A -= 1 1 A B -= 1 1 B S,T = input().split() input().split() S T = input().split() input().split() T A,B = (int(x) for x in input().split()) (int(x) for x in input().split()) A
S,T = input().split()
A,B = (int(x) for x in input().split())
U = input()
if U == S:
    A -= 1
    print(('{} {}'.format(A,B)))
else:
    B -= 1
    print(('{} {}'.format(A,B)))