import sys
S,T = input().split()
A,B = map(int,input().split())
U = input()

if not ( S.islower() and T.islower() and U.islower() ): sys.exit()
if not ( 1 <= len(S) <= 10 and 1 <= len(T) <= 10 ): sys.exit()
if not ( S != T ): sys.exit()
if not ( S == U or T == U ): sys.exit()
if not ( isinstance(A,int) and isinstance(B,int) ): sys.exit()

print(A-1,B,sep=' ') if U == S else print(A,B-1,sep=' ') import sys sys S,T = input().split() S input().split() ().split () input split T A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B U = input() U input() input if not ( S.islower() and T.islower() and U.islower() ): sys.exit() not ( S.islower() and T.islower() and U.islower() ) S.islower() and T.islower() and U.islower() S.islower() and T.islower() S.islower() S.islower S islower T.islower() T.islower T islower U.islower() U.islower U islower if not ( 1 <= len(S) <= 10 and 1 <= len(T) <= 10 ): sys.exit() not ( 1 <= len(S) <= 10 and 1 <= len(T) <= 10 ) 1 <= len(S) <= 10 and 1 <= len(T) <= 10 1 <= len(S) <= 10 1 <= len(S) 1 len(S) len S 10 1 <= len(T) <= 10 1 <= len(T) 1 len(T) len T 10 if not ( S != T ): sys.exit() not ( S != T ) S != T S T if not ( S == U or T == U ): sys.exit() not ( S == U or T == U ) S == U or T == U S == U S U T == U T U if not ( isinstance(A,int) and isinstance(B,int) ): sys.exit() not ( isinstance(A,int) and isinstance(B,int) ) isinstance(A,int) and isinstance(B,int) isinstance(A,int) isinstance A int isinstance(B,int) isinstance B int print(A-1,B,sep=' ') if U == S else print(A,B-1,sep=' ') U == S U S print(A-1,B,sep=' ') print A-1 A 1 B sep=' ' sep ' ' print(A,B-1,sep=' ') print A B-1 B 1 sep=' ' sep ' ' T = input().split() input().split() T A,B = map(int,input().split()) map(int,input().split()) A S,T = input().split() input().split() S U = input() input() U B = map(int,input().split()) map(int,input().split()) B
import sys
S,T = input().split()
A,B = map(int,input().split())
U = input()

if not ( S.islower() and T.islower() and U.islower() ): sys.exit()
if not ( 1 <= len(S) <= 10 and 1 <= len(T) <= 10 ): sys.exit()
if not ( S != T ): sys.exit()
if not ( S == U or T == U ): sys.exit()
if not ( isinstance(A,int) and isinstance(B,int) ): sys.exit()

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