#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
dic = defaultdict(int)
s,t = input().split()
a,b = readInts()
dic[s] = a
dic[t] = b
u = input()
dic[u] -= 1
print(dic[s], dic[t]) from fractions import gcd from itertools import combinations,permutations,accumulate from collections import deque,defaultdict,Counter import decimal decimal import re re import sys sys sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 def readInts():
  return list(map(int,input().split())) readInts return list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split def I():
  return int(input()) I return int(input()) int(input()) int input() input dic = defaultdict(int) dic defaultdict(int) defaultdict int s,t = input().split() s input().split() ().split () input split t a,b = readInts() a readInts() readInts b dic[s] = a dic[s] dic s a dic[t] = b dic[t] dic t b u = input() u input() input dic[u] -= 1 dic[u] dic u 1 print(dic[s], dic[t]) print dic[s] dic s dic[t] dic t def I():
  return int(input()) def I():
  return int(input()) I s,t = input().split() input().split() s a,b = readInts() readInts() a def readInts():
  return list(map(int,input().split())) def readInts():
  return list(map(int,input().split())) readInts dic = defaultdict(int) defaultdict(int) dic u = input() input() u mod = 10**9 + 7 10**9 + 7 mod b = readInts() readInts() b t = input().split() input().split() t
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
dic = defaultdict(int)
s,t = input().split()
a,b = readInts()
dic[s] = a
dic[t] = b
u = input()
dic[u] -= 1
print(dic[s], dic[t])
