import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


s, t = input().split()
a, b = inpl()
u = input()[:-1]
if u == s:
    print(a - 1, b)
else:
    print(a, b - 1) import sys, bisect, math, itertools, heapq, collections sys bisect math itertools heapq collections from operator import itemgetter from functools import lru_cache sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline INF = float('inf') INF float('inf') float 'inf' mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 eps = 10**-7 eps 10**-7 10 -7 def inp():
    '''
    一つの整数
    '''
    return int(input()) inp '''
    一つの整数
    ''' return int(input()) int(input()) int input() input def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split())) inpl '''
    一行に複数の整数
    ''' return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split s, t = input().split() s input().split() ().split () input split t a, b = inpl() a inpl() inpl b u = input()[:-1] u input()[:-1] () input :-1 -1 if u == s:
    print(a - 1, b)
else:
    print(a, b - 1) u == s u s print(a - 1, b) print a - 1 a 1 b print(a, b - 1) print a b - 1 b 1 a, b = inpl() inpl() a def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split())) def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split())) inpl def inp():
    '''
    一つの整数
    '''
    return int(input()) def inp():
    '''
    一つの整数
    '''
    return int(input()) inp input = sys.stdin.readline sys.stdin.readline input s, t = input().split() input().split() s t = input().split() input().split() t eps = 10**-7 10**-7 eps b = inpl() inpl() b INF = float('inf') float('inf') INF mod = 10**9 + 7 10**9 + 7 mod u = input()[:-1] input()[:-1] u
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


s, t = input().split()
a, b = inpl()
u = input()[:-1]
if u == s:
    print(a - 1, b)
else:
    print(a, b - 1)
