S, T = [x for x in input().split()]

A, B = [int(x) for x in input().split()]

U = input()

if S == U:
    A -= 1
else:
    B -= 1

print('{} {}'.format(A, B)) x for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() x S, T = [x for x in input().split()] S [x for x in 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 S == U:
    A -= 1
else:
    B -= 1 S == U S U A -= 1 A 1 B -= 1 B 1 print('{} {}'.format(A, B)) print '{} {}'.format(A, B) '{} {}'.format '{} {}' format A B A -= 1 1 A T = [x for x in input().split()] [x for x in input().split()] T A, B = [int(x) for x in input().split()] [int(x) for x in input().split()] A B = [int(x) for x in input().split()] [int(x) for x in input().split()] B B -= 1 1 B U = input() input() U S, T = [x for x in input().split()] [x for x in input().split()] S
S, T = [x for x in input().split()]

A, B = [int(x) for x in input().split()]

U = input()

if S == U:
    A -= 1
else:
    B -= 1

print('{} {}'.format(A, B))
