Problem:
 Score : 100 points    Problem Statement  We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one with the string U written on it and throws it away. Find the number of balls with the string S and balls with the string T that we have now.      Constraints   S , T , and U are strings consisting of lowercase English letters.  The lengths of S and T are each between 1 and 10 (inclusive).  S \not= T  S=U or T=U .  1 \leq A,B \leq 10  A and B are integers.         Input  Input is given from Standard Input in the following format:  S  T  A  B  U       Output  Print the answer, with space in between.        Sample Input 1 red blue
3 4
red      Sample Output 1 2 4  Takahashi chose a ball with red written on it and threw it away.
Now we have two balls with the string S and four balls with the string T .       Sample Input 2 red blue
5 5
blue      Sample Output 2 5 4  Takahashi chose a ball with blue written on it and threw it away.
Now we have five balls with the string S and four balls with the string T .

Solution (Python):
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from functools import *
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
    *a,=map(int,open(0))
def S_():
    return input()
def IS():
    return input().split()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'

    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['YES','NO']

mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()

input=lambda: sys.stdin.readline().rstrip()
 
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a
 
show_flg=False
show_flg=True
 
ans=0

s,t=input().split()
n,m=LI()
u=input()
if s==u:
    n-=1
else:
    m-=1

print(n,m)

Solution (Python):

s,t = input().split()
a,b=map(int,input().split())
u = input()

d = {s:a,t:b}
d[u]-=1

print(d[s],d[t])

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()

if S == U:
    A -= 1
elif T == U:
    B -= 1

print(A,B)

Solution (Python):
S,T=map(str,input().split())
A,B=map(int,input().split())
N=str(input())
ans=A
ans2=B
if N==S:
    ans=A-1
if N==T:
    ans2=B-1
print(ans,ans2)

Solution (Python):
s, t = map(str, input().split())
a, b = map(int,input().split())
u = input()

if u==s:
    print(a-1, b)

else:
    print(a, b-1)

Solution (Python):
inputs = input().split()
nums = list(map(int, input().split()))

S = inputs[0]
T = inputs[1]

A = nums[0]
B = nums[1]
U = input()

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

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

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

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()

if S == U:
    print(str(A-1) + " " + str(B))
else:
    print(str(A) + " " + str(B-1))

Solution (Python):
balls = input().split(" ")
nums = input().split(" ")
nums = [int(i) for i in nums]
u = input()

nums[balls.index(u)] -= 1

print("{} {}".format(nums[0], nums[1]))

Solution (Python):
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

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

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

dic = {}
dic[s] = a
dic[t] = b

dic[u] = dic[u] - 1

print(str(dic[s]) + " " + str(dic[t]))

Solution (Python):
import sys
from pprint import pprint

def solve(s, t, a, b, u):
    if u == s:
        a -= 1
    if u == t:
        b -= 1
    print(a, b)

if __name__ == '__main__':
    s, t = sys.stdin.readline().strip().split(" ")
    a, b = map(int, sys.stdin.readline().strip().split(" "))
    u = sys.stdin.readline().strip()
    solve(s, t, a, b, u)

Solution (Python):
s,t = input().split()
a,b = map(int,input().split())
u = input()

if u == s:
    a -= 1
else:
    b -= 1

list = [a,b]
print(*list)

Solution (Python):
S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())

if U == S:
    A -= 1
elif U == T:
    B -=1

print(A, B)

Solution (Python):
S,T=input().split()
A,B=map(int,input().split())
U=input()
if U==S:
    A=A-1
else:
    B=B-1
print('{} {}'.format(A, B))

Solution (Python):
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if s==u:
    a-=1
elif t==u:
    b-=1

print('{} {}'.format(a,b))

Solution (Python):
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()

if S == U:
    Snew = A-1
    Tnew = B
else:
    Snew = A
    Tnew = B-1
    
Snew = str(Snew) 
Tnew = str(Tnew)
Ans =Snew+" "+Tnew

print(Ans)

Solution (Python):
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()
if U == S:
    print(A-1,B)
else:
    print(A,B-1)

Solution (Python):
import sys

f = sys.stdin
S, T = f.readline()[:-1].split(' ')
A, B = map(int, f.readline().split(' '))
U = f.readline()[:-1]

if S == U:
    A -= 1
else:
    B -= 1

print(A, B)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    A -= 1
else:
    B -= 1

print(A, B)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

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

Solution (Python):
s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())
if u == s:
    a -= 1
elif u == t:
    b -= 1
print(a,b)

Solution (Python):
s, t = [x for x in input().split()]
a, b = [int(x) for x in input().split()]
u = input() 
if u == s:
    a -= 1
else:
    b -= 1
print("{} {}".format(a, b))

Solution (Python):



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

if S==U:
    A=A-1
else:
    B=B-1

print(A,B)

Solution (Python):
S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())
if U == S:
  A -= 1
elif U == T:
  B -= 1
print(str(A) + " " + str(B))

Solution (Python):
s, t = input().split()
num_a, num_b = input().split()
rm = input()
if rm==s:
    num_a = int(num_a) - 1
else:
    num_b = int(num_b) -1

print('{0} {1}'.format(num_a, num_b))

Solution (Python):
S,T = map(str, input().split())
A,B = map(int, input().split())
U = str(input())

if S == U:
    A -= 1
elif T == U:
    B -= 1

ans = [A,B]
print(*ans)

Solution (Python):
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if u==s:
	print(a-1,b)
else:
	print(a,b-1)

Solution (Python):
balls = input().split(" ")
nums = input().split(" ")
nums = [int(i) for i in nums]
u = input()

nums[balls.index(u)] -= 1

print("{} {}".format(nums[0], nums[1]))

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
color = input()
balls = {S:A, T:B}
balls[color] -=1
print(balls[S], balls[T])

Solution (Python):
I = input
s, t = I().split()
a, b = map(int, I().split())
u = I()
print(a - (u == s), b - (u == t))

Solution (Python):
input_s =[input() for i in range(3)]
color_1, color_2 = list(input_s[0].split())
a, b = list(map(int,input_s[1].split()))
color = input_s[2]
if  color == color_1:
    print(a-1, " ", b)
else:
    print(a, " ", b-1)

Solution (Python):
s, t = input().split()
a, b = list(map(int, input().split()))
u = input()

if u == s:
    a -= 1
elif u == t:
    b -= 1

print("{} {}".format(a, b))

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == S:
    A-=1
if U == T:
    B-=1

print(A,B)

Solution (Python):
S, T = input().rstrip().split()
A, B = map(int, input().rstrip().split())
U = input().rstrip()

d = {S: A, T: B}
d[U] -= 1
print('{} {}'.format(d[S], d[T]))

Solution (Python):
ball_color = list(map(str, input().split()))
ball_num = list(map(int, input().split()))
trash_color = input()

if (trash_color == ball_color[0]):
    ball_num[0]=ball_num[0]-1
elif (trash_color == ball_color[1]):
    ball_num[1]=ball_num[1]-1

print(str(ball_num[0]) + " " + str(ball_num[1]))

Solution (Python):
a, b = map(str, input().split())
num_a, num_b = map(int, input().split())
c = str(input())

if c==a:
  print(num_a-1, num_b)
else:
  print(num_a, num_b-1)

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()

if S==U:
    A-=1
else:
    B-=1

print(A,B)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
  a -= 1
elif t == u:
  b -= 1
print(a, b)

Solution (Python):
S, T = input().split()
A, B = input().split()
A = int(A)
B = int(B)
U = input()

if S == U:
    print("{} {}".format(A - 1, B))
else :
    print("{} {}".format(A, B - 1))

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()

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

print("{} {}".format(A,B))

Solution (Python):
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]


a, b = fetch_one_line().split(" ")
a_n, b_n = [int(i) for i in fetch_one_line().split(" ")]
remove_str = fetch_one_line()

if a == remove_str:
    a_n -= 1

else:
    b_n -= 1

print(a_n, b_n)

Solution (Python):
a,b = input().split()
c,d = map(int,input().split())
e = input()
dic = {a:c, b:d}

dic[e]+=-1

print(dic[a],dic[b])

Solution (Python):
s,t=input().split()
a,b = map(int,input().split())
u = input()
if s==u:
  a-=1
else:
  b-=1
print(a,b)

Solution (Python):
s,t=input().split()
i,j=map(int,input().split())
u=input()

if s==u:
  i=i-1
else:
  j=j-1
a=str(i)+" "+str(j)
print(a)

Solution (Python):


S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:
  A = A-1
else:
  B = B-1
print(A,B)

Solution (Python):
s, t = list(input().split())
a, b = list(map(int, input().split()))
u = input()

if s == u:
    print(str(a-1) + ' ' + str(b))
else:
    print(str(a) + ' ' + str(b-1))

Solution (Python):
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(str, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


def sosu(x):
    for i in range(2, int(sqrt(x)+1)):
        if x % i == 0:
            return False
    return True


mod = 1000000007
inf = float('INF')


def A():
    S, T= LS()
    A,B= LI()
    U= input().rstrip()



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


    
    return




def B():
    N,K,M = LI()
    A = LI()
    ans=M*N- sum(A)
    if ans>K:
        print(-1)
    elif ans<0:
        print(0)
    else:
        print(ans)


    return




def true():
    S = input()
    S = S[:-1]

    tmp = 0
    for x in range(1 << (len(S)-1)):
        func = S[-1]
        for i in range(len(S)-1):
            if(x & (1 << i)):
                tmp += int(func)
                func = S[-2-i]
            else:
                func = S[-2-i]+func
        tmp += int(func)
    print(tmp)

    return


def C():
    N, M = LI()
    P=[]
    S=[]
    count=set([])
    ans=[0]*1000000
    realans=0
    for i in range(M):

        p,s=input().split()
        p=int(p)
        if s=='AC':
            realans+=ans[p]
            count.add(p)
            ans[p]=0
        if s=='WA' and p not in count:
            
            ans[p]+=1
  


    
    print(len(count),realans)
    

        


        




def D():

    H, W= LI()
    S=[]
    d=0
    for i in range(H):
        tmp=input().rstrip()
        c=0
        for j in tmp:
            if '.'==j:
                S.append(d*100+c)
            c+=1
        d+=1
    print(S)



    return




def E():
    N, K = LI()
    A = LI()
    F = LI()
    A.sort(reverse=True)
    F.sort()
    cost = []
    for i in range(len(N)):
        cost.append(A[i]*F[i])

    a = F[cost.index(max(cost))]

    return




def F():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

    



def solution(S):
    
    N = len(S)

    pass



if __name__ == '__main__':

    A()

Solution (Python):
S,T=input().split()
A,B=map(int, input().split()) 
U=input()
if S==U :
    A=A-1
elif T==U:
    B=B-1
print(A,B)

Solution (Python):
s,t = map(str,input().split())
a,b = map(int,input().split())
u = input()

if s == u:
    print(a-1 , b)
else:
    print(a , b-1)

Solution (Python):
arr = input().split(" ")
num = list(map(lambda x: int(x), input().split(" ")))
lost = input()

if arr[0] == lost:
    num[0] = num[0] - 1
elif arr[1] == lost:
    num[1] = num[1] - 1
print(str(num[0]) + " " + str(num[1]))

Solution (Python):
S,T = input().split()
sn,tn = map(int,input().split())
U = input()
if U == S:
  print(sn-1,tn)
elif U == T:
  print(sn,tn-1)
else:
  print(sn,tn)

Solution (Python):
def I(): return int(input())
def MI(): return map(int, input().split())
def LMI(): return list(map(int, input().split()))


S, T = input().split()
A, B = MI()
U = input()
if U == S:
    A -= 1
elif U == T:
    B -= 1
print(A, B)

Solution (Python):
s,t = input().split()
a,b = map(int, input().split())
u = input()

if s == u:
    a -= 1
else:
    b -= 1
print(' '.join(map(str, [a, b])))

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()

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

Solution (Python):
s,t = input().split()
a,b = map(int,input().split())
u = input()
if u == s:
    print(a-1, b)
else:
    print(a, b-1)

Solution (Python):


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

if U == S:
    A = A - 1
elif U == T:
    B = B - 1

print(A, B)

Solution (Python):
s,t=input().split()
a,b=map(int,input().split())
u=input()

if s == u:
    print(a-1,b)
else:
    print(a,b-1)

Solution (Python):
slist = raw_input().split()
nlist = map(int, raw_input().split())

sel = raw_input()

if sel == slist[0]:
    print nlist[0]-1, nlist[1]
else:
    print nlist[0], nlist[1]-1

Solution (Python):
s,t = map(str,input().split())
a,b = map(int,input().split())
u = input()
if s == u :
    print(a-1,b)
elif t == u :
    print(a,b-1)

Solution (Python):
st = input().split()

ab = list(map(int, input().split()))

u=input()

if st[0]==u:
    print(ab[0]-1,end="")
    print(" ",end="")
    print(ab[1])
elif st[1]==u:
    print(ab[0],end="")
    print(" ",end="")
    print(ab[1]-1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
  out_1 = A - 1
  if out_1 < 0: out1 = 0
  out_2 = B
  print(out_1, out_2)

if T == U:
  out_1 = A
  out_2 = B -1
  if out_2 < 0: out_2 = 0
  print(out_1, out_2)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

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

print(A, B)

Solution (Python):
c1, c2 = input().split()
n = input().split()
n1 = int(n[0])
n2 = int(n[1])
u = input()
if(u == c1):
  print(str(n1 - 1) + " " + str(n2))
else:
  print(str(n1) + " " + str(n2 - 1))

Solution (Python):
S,T= input().split()
A,B= map(int, input().split())
U=input()

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

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
    A -= 1
else:
    B -= 1

print(A, B)

Solution (Python):
if __name__ == "__main__":
    s,t = map(str,input().split())
    a,b = map(int,input().split())
    u = str(input())
    if s == u:
        print("{} {}".format(a-1,b))
    else:
        print("{} {}".format(a,b-1))

Solution (Python):
s, t = map(str, input().split())

s_num, t_num = map(int, input().split())

u = str(input())

input_dict = {s:s_num, t:t_num}

input_dict[u] -= 1

print(input_dict[s], input_dict[t])

Solution (Python):
def main():
    S,T = map( str, input().split())
    A,B = map( int, input().split())
    U = str(input())
    if U==S:
        print(A-1,B)
    elif U==T:
        print(A,B-1)
    

if __name__ == '__main__':
    main()

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

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

Solution (Python):
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()

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

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
    a -= 1
else:
    b -= 1

print("{} {}".format(a,b))

Solution (Python):
S, T = input().split()
A, B = [int(i) for i in input().split()]
U = input()
if U==S:
    A=A-1
else:
    B=B-1
print(A, B)

Solution (Python):
str1, str2 = input().split()
str1_count, str2_count = map(int, input().split())
str3 = input()

if(str3 == str1):
    str1_count -= 1
else:
    str2_count -= 1
    
print(str1_count, str2_count)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()


if S == U:
  A = A - 1
else:
  B = B - 1
  
print (str(A) + " " + str(B))

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    A -= 1
else:
    B -= 1
print(str(A) + " " + str(B))

Solution (Python):
import sys
import numpy as np

color_1, color_2 = input().split()

co1_n, co2_n = map(int, input().split())

del_col = input()

if del_col == color_1:
    co1_n -= 1
if del_col == color_2:
    co2_n -= 1
    
print(str(co1_n), str(co2_n))

Solution (Python):
s, t = input().split(" ")
a, b = map(int, input().split(" "))
u = input()

if s == u:
    print(a-1, b)
elif t == u:
    print(a, b-1)
else:
    print(a, b)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

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

Solution (Python):
s, t = list(map(str,input().split()))
a, b = list(map(int,input().split()))
u = list(map(str,input().split()))[0]

if s == u:
    print(a-1, b)
else:
    print(a, b-1)

Solution (Python):
S, T = map(str,input().split())
A, B = map(int,input().split())
U = input()
if U == S:
    A -= 1
else:
    B -= 1
print(str(A) +' '+ str(B))

Solution (Python):
s, t = input().split()
n_s, n_t = map(int, input().split())
if input() == s:
    n_s -= 1
else:
    n_t -= 1

print(n_s, n_t)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
  a = a-1
else:
  b = b-1
print(a,b)

Solution (Python):
sList = list(input().split())
nList = list(map(int,input().split()))

s = input()

if s == sList[0]:
  nList[0] -= 1
else:
  nList[1] -= 1

print(nList[0],nList[1])

Solution (Python):
s,t=input().split()
a,b=map(int,input().split())
u=input()

if (s==u) :
    a -= 1
else:
    b -= 1
print(a,b)

Solution (Python):
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()
if U == S:
    A -= 1
else: B -= 1
print (A,B)

Solution (Python):
ST = input().split()
num = list(map(int, input().split()))
U = input()

if (U == ST[0]):
    num[0] -= 1
else:
    num[1] -= 1

print(num[0],num[1])

Solution (Python):
color=[i for i in input().split()]
num=[int(i) for i in input().split()]
rem=input()

if rem==color[0]:
    num[0]-=1
    print(str(num[0])+" "+str(num[1]))
    
else :
    num[1]-=1
    print(str(num[0])+" "+str(num[1]))
    
print()

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()

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

Solution (Python):
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if S==U:
    A-=1
else:
    B-=1
    

print("{} {}".format(A, B))

Solution (Python):
s,t=input().split()
a,b=[int(x) for x in input().split()]
u=input()
if s==u:
    print(a-1,b)
else:
    print(a,b-1)

Solution (Python):
s,t = map(str, input().split())
a,b = map(int, input().split())
u = input()

if u == s:
  a-=1
elif u == t:
  b-=1
  
print(str(a) + " " + str(b))

Solution (Python):
S,T = input().split()
A,B = list(map(int,input().split()))
U = input()

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

Solution (Python):
S,T = input().split()
A,B = map(int, input().split())
U = input()
if U == S:
    A -= 1
elif U == T:
    B -= 1
print(A, B)

Solution (Python):
S, T =input().split()
A, B = input().split()
A = int(A)
B = int(B)
U = input()

if U == S:
    A = A - 1
else:
    B = B-1

print(A, B)

Solution (Python):
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()

if(S == U):
  A = A - 1
elif(T == U):
  B = B - 1

print("{} {}".format(A,B))

Solution (Python):
s, t = map(str, input().split(' '))
a, b = map (int, input().split())
u = str(input())

if u == s:
    a = a - 1
else:
    b = b - 1

print(str(a),'', str(b))

Solution (Python):
s, t = input().split()
a, b = (int(x) for x in input().split())
u = input()

if s == u:
  a -= 1
else:
  b -= 1

print('{} {}'.format(a, b))

Solution (Python):
a,b = input().split()
s,t = input().split()
c = input()

if (a == c):
  s = int(s) - 1
else:
  t = int(t) - 1

print(str(s) + " " + str(t))

Solution (Python):
s, t = input().split()
a, b = map(int,input().split())
u = input()

if(s == u):
    print(str(a-1) + ' ' + str(b))
else:
    print(str(a) + ' ' + str(b-1))

Solution (Python):
s = input().split()
s2 = input().split()
s3 = input()

if s3 == s[0]:
    ss = int(s2[0]) - 1
    print(str(ss) + " " + s2[1])
else:
    ss = int(s2[1]) - 1
    print(s2[0] + " " + str(ss))

Solution (Python):
red,blue = input().split()
r,b = map(int,input().split())
u = input()
if u == red:
    print(r-1, b)
else:
    print(r, b-1)

Solution (Python):
S, T= input().split()
A, B = map(int, input().split())
U = input()
if S==U:
    print(str(A-1)+" "+str(B))
else:
    print(str(A)+" "+str(B-1))

Solution (Python):
def func():
    return



s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
    a -= 1
else:
    b -= 1

print("%d %d"%(a, b))

Solution (Python):
x = input().split()
s = x[0]
t = x[1]

y = input().split()
a = int(y[0])
b = int(y[1])

u = input()

if s == u:
  a -= 1
else:
  b -= 1

print('{} {}'.format(a,b))

Solution (Python):
s,t = map(str,raw_input().strip().split())
dic = {}
a,b = map(int,raw_input().strip().split())
dic[s] = a
dic[t] = b
u = raw_input()
dic[u] = dic[u]-1
print("%d %d"%(dic[s],dic[t]))

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if(S == U):
    print(str(A-1) + " " + str(B))
else:
    print(str(A) + " " + str(B-1))

Solution (Python):
S,T = list(map(str,input().split()))
A,B = list(map(int,input().split()))
U = input()


if U == S:
    print(max(A-1,0),B)
elif U == T:
    print(A,max(B-1,0))
else:
    print(A,B)

Solution (Python):
S, T = input().split()
A, B = map(int,input().split())
U = input()
if U == S:
    A -= 1
else:
    B -= 1
print(str(A)+' '+str(B))

Solution (Python):
s, t = input().split()
a, b = map(int,input().split())
u = input()

if u == s:
    print((a-1), b)
else:
    print(a, (b-1))

Solution (Python):
s, t = map(str,input().split())	
a, b = map(int,input().split())	
u = input()
if(s == u):
  a -= 1;
elif(t == u):
  b -= 1;
print("{} {}".format(a, b))

Solution (Python):

s,t = map(str,input().split())
a,b = map(int,input().split())
u = input()



if u == s:
    print(a-1,b)
else:
    print(a,b-1)

Solution (Python):
S,T = input().split()
A,B = map(int, input().split())
U = input()

if S == U:
    A-=1
else:
    B-=1

print(A,B)

Solution (Python):
c1 ,c2 = map(str,input().split())
n1 ,n2 = map(int,input().split())
u = str(input())

if u == c1:
    n1 = n1 - 1
else:
    n2 = n2 - 1

print("{} {}".format(n1,n2))

Solution (Python):
s, _ = list(input().split())
a, b = list(map(int, input().split()))
u = input()
if s == u:
    a -= 1
else:
    b -= 1
print(a, end=' ')
print(b)

Solution (Python):
[S,T] = input().rstrip().split(' ')
[A,B] = [int(s) for s in input().rstrip().split(' ')]
U = input()
if U == S:
  print(str(A-1) + " " +str(B))
else:
  print(str(A) + " " +str(B-1))

Solution (Python):
ST = input().split()
S = ST[0]
T = ST[1]

AB = input().split()
A = int(AB[0])
B = int(AB[1])

U = input()

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

Solution (Python):
s,t = list(map(str, input().split()))
n,m = map(int, input().split())
u = str(input())
if u == s:
    print(n-1,m)
else:
    print(n,m-1)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
    a -= 1
else:
    b -= 1

print(a, b)

Solution (Python):
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

if u == s:
  a -= 1
else:
  b -= 1

print(a, b)

Solution (Python):

line = input().split(" ")
S, T = line
line = input().split(" ")
A, B = int(line[0]), int(line[1])
U = input()

if U == S:
    A -= 1
else:
    B -= 1

print(A, B)

Solution (Python):
s=input()
t=list(map(int,input().split()))
u=input()
v=s.split()
for i in range(2):
  if v[i]==u:
    t[i]-=1
print(*t)

Solution (Python):
S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())
if S==U:
  print(A-1, B)
else:
  print(A, B-1)

Solution (Python):


s,t=input().split()
a,b=map(int, input().split())
u=input()

if s == u:
    print(a-1, b)
elif t == u:
    print(a, b-1)
else:
    print(a, b)

Solution (Python):
s, t = input().split()
a, b = list(map(int, input().split()))
u = input()

if u == s:
	print(a - 1, b)
else:
	print(a, b - 1)

Solution (Python):
S, T=input().split()

A, B=map(int, input().split())
U=input()

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

Solution (Python):


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

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

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
    a -= 1
elif u == t:
    b -= 1
print(str(a) + " " + str(b))

Solution (Python):
S,T=input().split()
A,B=map(int, input().split())
U=input()
if S==U:
  A -= 1
else:
  B -= 1
print(A,B)

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()
ans1 = A
ans2 = B
if S==U:
    ans1 -= 1
else:
    ans2 -= 1
print(ans1, ans2)

Solution (Python):
s,t = input().split()
a,b = map(int,input().split())
u = input()

if u==s:
    print(a-1,b)
else:
    print(a,b-1)

Solution (Python):
chr_list = input().split()
number_list = list(map(int, input().split()))
chr = input()

ch_dict = {}
for each_ch, number in zip(chr_list, number_list):
    ch_dict[each_ch] = number

ch_dict[chr] = ch_dict[chr] - 1

for each_ch in chr_list:
    print(ch_dict[each_ch], end="")
    print(" ", end="")

Solution (Python):
s,t = input().split()
a,b = map(int,input().split())
u = input()
 
if u == s:
    print("{} {}".format(str(a-1),str(b)))
else:
    print("{} {}".format(str(a),str(b-1)))

Solution (Python):
col = input().split()
ball = list(map(int, input().split()))
choice = input()

if col[0] == choice:
  ball[0] = ball[0] - 1
else:
  ball[1] = ball[1] - 1

print(str(ball[0]) + " " + str(ball[1]))

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

if s == u:
    a -= 1
else:
    b -= 1

print(str(a) + " " + str(b))

Solution (Python):
S=list(input().split())
A=list(map(int,input().split()))
N=input()

if S[0]==N:
  A[0]-=1
else:
  A[1]-=1
print(A[0],A[1])

Solution (Python):
S,T=input().split()
A,B=map(int, input().split()) 
U=input()
if S==U :
    A=A-1
elif T==U:
    B=B-1
print(A,B)

Solution (Python):
s,t=input().split()
a,b=map(int, input().split())
u=input()
if s==u:
    print(str(a-1)+" "+str(b))
else:
    print(str(a)+" "+str(b-1))

Solution (Python):
s,t = input().split()
a,b = map(int,input().split())
u = input()
if s == u:
  a -= 1
else:
  b -= 1
print(str(a)+" "+str(b))

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

if s == u:
  a -= 1
else:
  b -= 1
print(str(a) + " " + str(b))

Solution (Python):
import re

s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

m = re.match(u, s)
if m is None:
    m = re.match(u, t)
    if m is not None:
        b -= 1
else:
    a -= 1

print(a, b)

Solution (Python):


def main():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()

    index = [S, T].index(U)
    if index == 0:
        A -= 1
    else:
        B -= 1
    print("{} {}".format(A, B))


if __name__ == '__main__':
    main()

Solution (Python):
S,T = input().split()
A,B = map(int, input().split())
N = input()

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

Solution (Python):
s,t = input().split()
a,b= map(int,input().split())
u = input()

if(s==u):
    a-=1
elif(t==u):
    b-=1
    
print(a,b)

Solution (Python):
a,b=list(map(str, input().split()))
c,d=list(map(int, input().split()))
n=input()
if n==a:
  print(c-1,d)
else:
  print(c,d-1)