[S, T] = [str(i) for i in input().split()]
[A, B] = [int(i) for i in input().split()]
U = str(input())

if S == U:
    print(A-1, B)
else:
    print(A, B-1) str(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() str(i) str i [S, T] = [str(i) for i in input().split()] [S, T] S T [str(i) for i in input().split()] 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, B] A B [int(i) for i in input().split()] U = str(input()) U str(input()) str input() input if S == U:
    print(A-1, B)
else:
    print(A, B-1) S == U S U print(A-1, B) print A-1 A 1 B print(A, B-1) print A B-1 B 1 U = str(input()) str(input()) U
[S, T] = [str(i) for i in input().split()]
[A, B] = [int(i) for i in input().split()]
U = str(input())

if S == U:
    print(A-1, B)
else:
    print(A, B-1)