#Macで実行する時
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../atcoder/input.txt'))
	sys.stdin = open(name)

l = list(map(str,input().split()))
a,b = map(int,input().split())
check = input()

if check == l[0]:
    a -= 1
else:
    b -= 1

print(a,b)

 import sys sys import os os if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../atcoder/input.txt'))
	sys.stdin = open(name) sys.platform=="darwin" sys.platform sys platform "darwin" base = os.path.dirname(os.path.abspath(__file__)) base os.path.dirname(os.path.abspath(__file__)) os.path.dirname os.path os path dirname os.path.abspath(__file__) os.path.abspath os.path os path abspath __file__ name = os.path.normpath(os.path.join(base, '../atcoder/input.txt')) name os.path.normpath(os.path.join(base, '../atcoder/input.txt')) os.path.normpath os.path os path normpath os.path.join(base, '../atcoder/input.txt') os.path.join os.path os path join base '../atcoder/input.txt' sys.stdin = open(name) sys.stdin sys stdin open(name) open name l = list(map(str,input().split())) l list(map(str,input().split())) list map(str,input().split()) map str input().split() ().split () input split a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b check = input() check input() input if check == l[0]:
    a -= 1
else:
    b -= 1 check == l[0] check l[0] l 0 a -= 1 a 1 b -= 1 b 1 print(a,b) print a b check = input() input() check base = os.path.dirname(os.path.abspath(__file__)) os.path.dirname(os.path.abspath(__file__)) base a -= 1 1 a name = os.path.normpath(os.path.join(base, '../atcoder/input.txt')) os.path.normpath(os.path.join(base, '../atcoder/input.txt')) name a,b = map(int,input().split()) map(int,input().split()) a b -= 1 1 b b = map(int,input().split()) map(int,input().split()) b l = list(map(str,input().split())) list(map(str,input().split())) l
#Macで実行する時
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../atcoder/input.txt'))
	sys.stdin = open(name)

l = list(map(str,input().split()))
a,b = map(int,input().split())
check = input()

if check == l[0]:
    a -= 1
else:
    b -= 1

print(a,b)


