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):


def abc154a(s, t, a, b, u):
    if(s == u):
        a -= 1
    else:
        b -= 1
    return(a, b)



if(__name__ == '__main__'):
    
    (s, t) = input().split()
    (a, b) = map(int, input().split())
    u = input()
    
    (new_a, new_b) = abc154a(s, t, a, b, u)
    
    
    print(str(new_a) + " " + str(new_b))

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

Solution (Python):


def abc154a(s, t, a, b, u):
    if(s == u):
        a -= 1
    else:
        b -= 1
    return(a, b)





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

(new_a, new_b) = abc154a(s, t, a, b, u)


print(str(new_a) + " " + str(new_b))

Solution (Python):
c1, c2 = input().split()
a, b = map(int, input().split())
c = input()
if c == c1:
    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:
    print(A-1, B)
elif U == T:
    print(A, B-1)
else:
    print(-1)

Solution (Python):


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

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

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

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(str(A) + " " + str(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("{} {}".format(A,B))

Solution (Python):
input_S_T = list(input().split())
input_count = list(map(int,input().split()))
input_trash = input()

total_list = []

for i in range(input_count[0]):
    total_list.append(input_S_T[0])

for i in range(input_count[1]):
    total_list.append(input_S_T[1])

total_list.remove(input_trash)

print(total_list.count(input_S_T[0]),total_list.count(input_S_T[1]),end=' ')

Solution (Python):

import sys
from collections import OrderedDict
d = OrderedDict()
s,t = sys.stdin.readline().split()
n1, n2 = map(int, sys.stdin.readline().split())
d[s] = n1
d[t] = n2

d[sys.stdin.readline().rstrip()] -=1

print(*d.values())

Solution (Python):
input_S_T = list(input().split())
input_count = list(map(int,input().split()))
input_trash = input()

total_list = []

for i in range(input_count[0]):
    total_list.append(input_S_T[0])

for i in range(input_count[1]):
    total_list.append(input_S_T[1])

total_list.remove(input_trash)

print(total_list.count(input_S_T[0]),total_list.count(input_S_T[1]),end=' ')

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):
A = input().split()
B =  list(map(int, input().split()))
U = input()

if A[0] == U:
    print(str(B[0]-1) + " " + str(B[1]))

if A[1] == U:
    print(str(B[0]) + " " + str(B[1]-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):
s, t = map(str, 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):
def main():
    colors = list(map(str, input().split(" ")))
    nums = list(map(int, input().split(" ")))
    trash = input()
    
    nums[colors.index(trash)] -= 1
    print(' '.join(map(str, nums)))

main()

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

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

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

Solution (Python):
s = list(map(str, input().split()))
num = list(map(int, input().split()))
ALL = {}
for i in range(len(s)):
  ALL[s[i]] = num[i]
 
ALL[input()] -= 1
 
for i in range(len(s)):
  print(ALL[s[i]], end = ' ')

Solution (Python):
moji = input().split()
kazu = list(map(int, input().split()))
moji_w = input()

if moji[0] == moji_w:
  kazu[0] = kazu[0] - 1
else:
  kazu[1] = kazu[1] - 1
print("{} {}".format(kazu[0], kazu[1]))

Solution (Python):
moji=input().split()
kazu=list(map(int,input().split()))
U=input()

if U==moji[0]:
  kazu[0]=kazu[0]-1
else:
  kazu[1]=kazu[1]-1
  
print(kazu[0],kazu[1])

Solution (Python):
S, T = [str(s) for s in input().split()]
A, B = [int(i) for i in input().split()]
U = str(input())

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

Solution (Python):
text_st = input()
text_ab = input()
u = input()

def get(text,n):
    ans = [""]*n
    i = 0
    for x in text:
        if x==" ":
            i = i + 1
        ans[i] = ans[i]+x
    return ans

s = get(text_st,2)[0]
t = get(text_st,2)[1]
a = int(get(text_ab,2)[0])
b = int(get(text_ab,2)[1])

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

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

Solution (Python):


"""
Created on Thu Feb 13 19:20:01 2020

@author: dantitussalajan
"""
'''

a = int(input())

b, c = map(int, input().split())

s = input()

print(str(a+b+c) + " " + s)
'''


S,T=map(str,input().split())

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

U=input()

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

Solution (Python):
s1, s2 = input().split()
a1, a2 = [int(i) for i in input().split()]
s = input()

if s1 == s:
  print(a1 - 1, a2)
elif s2 == s:
  print(a1, a2 - 1)
else:
  print(a1, a2)

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

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

print(BallA, BallB)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s :
    print( str(a-1) + " " + str(b))
elif u == t :
    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(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) = input().split(" ")
(a, b) = [int(i) for i in 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 = input().split()
a_b = list(map(int, input().split()))
u = input()

if s_t[0]==u:
  a_b[0]-=1
else:
  a_b[1]-=1
  
print(a_b[0], a_b[1])

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=map(str, input().split())
a,b=map(int, input().split())
x=input()


if x==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 u==s:
    a -= 1
if u==t:
    b -= 1

print(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 = list(map(int, input().split(' ')))
U = input()
if U==S: print(A-1,B)
if U==T: print(A,B-1)

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=input().replace('\n','').split()
A,B=map(int,input().replace('\n','').split())
U=input().replace('\n','')

if U==S:
  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:
  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 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:
    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(a, b)

Solution (Python):
[S,T]=list(input().split())
[A,B]=map(int,list(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 S == U:
  A -= 1
else:
  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
else:
  b -=1
print(a,b)

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

if S==U:
    print(A-1,B)
elif T==U:
    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=A-1
elif U==T:
    B=B-1

print(A,B)

Solution (Python):
str_list = input().rstrip().split(' ')
num_list = input().rstrip().split(' ')
output = input().rstrip().split(' ')[0]
target_index = str_list.index(output)
num_list[target_index] = int(num_list[target_index]) - 1

out_str = ''
for i, num in enumerate(num_list):
  out_str += str(num)
  if i != len(num_list) - 1:
    out_str += ' '
print(out_str)

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 = str(input())

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

Solution (Python):
ST = input().split(" ")
AB = input().split(" ")
AB = [int(i) for i in AB]
U = input()
if U ==ST[0]:
    AB[0] -= 1
else:
    AB[1] -= 1
print(str(AB[0])+" "+str(AB[1]))

Solution (Python):
color=input().split()
x,y=map(int,input().split())
color2=input()

if color2==color[0]:
    print(x-1,y)
else:
    print(x,y-1)

Solution (Python):
color=input().split()
x,y=map(int,input().split())
color2=input()

if color2==color[0]:
    print(x-1)
    print(y)
else:
    print(x)
    print(y-1)

Solution (Python):
c1, c2 = input().split()
b1, b2 = map(int, input().split())
u = input()

if (u == c1):
    b1 -= 1
else:
    b2 -= 1

print(b1,b2)

Solution (Python):
s,t = raw_input().split()
a,b = map(int, raw_input().split())
u = raw_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:
    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=a-1
else:
    b=b-1
print(str(a)+" "+str(b))

Solution (Python):
red,blue=input().split()
a,b=(int(x) for x in input().split())
dic={red:a,blue:b}
u=input()
dic[u]-=1
print(str(dic[red])+" "+str(dic[blue]))

Solution (Python):
x, y = input().strip().split()
a, b = [int(i) for i in input().strip().split()]
z = input().strip()
if z == x: a -= 1
else: b -= 1
print(a, b)

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

ans1 = int(A)
ans2 = int(B)
if S == U:
  ans1 = ans1 - 1
if T == U:
  ans2 = ans2 - 1

print(ans1, ans2)

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 = 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()

if u == t:
    print(a,b-1)
else:
    print(a-1,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()
if s==u: a-=1
if t==u: b-=1
print(a,b)

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

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

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 S == U:
  A = A - 1
else:
  B = B - 1
print(' '.join(map(str, [A, B])))

Solution (Python):
components =input().rstrip().split(" ")
numbers=input().rstrip().split(" ")
decrease =input()
dictionary ={components[0]:numbers[0],components[1]:numbers[1]}

(dictionary[decrease])=int(dictionary[decrease])-1
print(dictionary[components[0]],dictionary[components[1]])

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

if s==u:
    a=a-1

elif t==u:
    b=b-1

print(a)
print(b)

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

Solution (Python):
s,t =input().split()
a,b =input().split()
A = int(a)
B = int(b)
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 s==u:
  print(a-1,b)
else:
  print(a,b-1)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S,T=ST().split()
    A,B=MI()
    U=ST()
    print(A-(U==S), B-(U==T))
if __name__ == '__main__':
    main()

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):
def main():
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()

    print('{} {}'.format(a-1, b) if s == u else '{} {}'.format(a, b-1))


if __name__ == '__main__':
    main()

Solution (Python):
s,t = map(str, input().split())
a,b = map(int, input().split())
u = input()
if s == u:
  print("{} {}".format(a-1, b))
else:
  print("{} {}".format(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
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:
	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:
  print(str(a-1) + " " + str(b))
else:
  print(str(a) + " " + str(b - 1))

Solution (Python):
str1, str2 = input().split()
num1, num2 = map(int,input().split())
trim = input()
 
if trim == str1:
	num1 = num1 - 1
else:
  	num2 = num2 - 1
 
print("%d %d"  %(num1, num2))

Solution (Python):
s,b = input().split()
d = {}
d[s],d[b] = [int(x) for x in input().split()]
d[input()] -= 1
print(d[s],d[b])

Solution (Python):
s, t = input().split(" ")
n_s, n_t = input().split(" ")
u = input()
bag = {s:int(n_s), t:int(n_t)}
bag[u] -= 1
print("{} {}".format(bag[s], bag[t]))

Solution (Python):
moji = list(map(str,input().split()))
kazu = list(map(int,input().split()))
U = input()
kazu[moji.index(U)] -= 1
print(kazu[0],kazu[1])

Solution (Python):
c = input().split()
n = [int(c) for c in input().split()]
idx = c.index(input())
n[idx] -= 1
print(" ".join([str(c) for c in n]), end="\n")

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()
if u == s:
    print(a-1,b)
else:
    print(a,b-1)

Solution (Python):
a,b=[i for i in input().split()]
n,m=[int(i) for i in input().split()]
s=input()
if s == a:
  n-=1
else:
  m-=1
print(n,m)

Solution (Python):
S,T = map(str,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()
nums  = input()
removed=input()

balls = balls.split()
nums  = nums.split()

if balls[0] == removed:
  nums[0] = int(nums[0]) - 1
  nums[1] = int(nums[1])
else:
  nums[0] = int(nums[0])
  nums[1] = int(nums[1]) - 1

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

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

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

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

ans0 = nums[0] - int(alc[0]==choose)
ans1 = nums[1] - int(alc[1]==choose)
print(ans0, ans1)

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 = list(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 = input().split()
A, B = list(map(int, input().split()))
U = input()

Count = {S:A, T:B}
Count[U] -= 1

print(Count[S], Count[T])

Solution (Python):
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S, T = read_str_list()
    A, B = read_int_list()
    U = read_str()
    if U == S:
      res = A - 1, B
    elif U == T:
      res = A, B - 1
    print(res[0], res[1])


main()

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

main()

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):
a = input().split()
 
b = [int(x) for x in input().split()]
 
c = input()
 
if c == a[0]:
  b[0]-=1
elif c == a[1]:
  b[1]-=1
 
if b[0] < 0:
  b[0] = 0
if b[1] < 0:
  b[1] = 0
print("{} {}".format(*b))

Solution (Python):
inp = list(map(str, input().split()))
S = inp[0]
T = inp[1]
inp = list(map(int, input().split()))
A = inp[0]
B = inp[1]
U = str(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 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)
else:
    print(a, b-1)

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("{} {}".format(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("{} {}".format(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 (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('{} {}'.format(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("{} {}".format(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):
def solve(string):
    s, t, a, b, u = string.split()
    return "{} {}".format(int(a) - (s == u), int(b) - (t == u))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

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):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, 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(list, 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)]
mod = 1000000007
inf = float('INF')


def solve():
    s,t = LS()
    a,b = LI()
    u = S()
    if s == u:
        print(a - 1, b)
    else:
        print(a, b - 1)
    return



if __name__ == '__main__':
    solve()

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:
    print(a-1,b)
else:
    print(a,b-1)

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

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

    print(a,b)

if __name__ == '__main__':
    main()

Solution (Python):
S, T = input().split()
s, t = map(int, input().split())
U = input()

if S == U:
    print(s - 1, t)
else:
    print(s, t - 1)

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

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


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

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:
    print(a-1, b)
elif u == t:
    print(a, b-1)

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

Solution (Python):
def main():
    s = input().split()
    n, m = list(map(int, input().split()))
    d = input()
    
    if s[0] == d:
        print(n - 1, m)
    else:
        print(n, m - 1)


if __name__ == "__main__":
    main()

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

Solution (Python):
color = input().split() 
count = list(map(int, input().split())) 
select_color = input() 

for i in range(0, 2):
    if select_color == color[i]:
        count[i] -= 1
print(count[0], count[1])

Solution (Python):
ab = list(input().split())
cd = list(map(int,input().split()))
if input() == ab[0]:
  cd[0] -=1
else:
  cd[1] -=1

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

Solution (Python):
S, T = [i for i in input().split()]
A, B = [int(i) for i in input().split()]
U = input()
res = {}

res[S] = A
res[T] = B

res[U] = res[U] - 1

print(res[S], res[T])

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):
ST = input().split()
AB = list(map(int, input().split()))
U = input()

AB[ST.index(U)] -= 1
print(' '.join(map(str, AB)))

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 u == s:
  a -= 1
else:
  b -= 1
print(a, b)

Solution (Python):
s,t=input().split()
x,y=map(int,input().split())
ss=input()
if ss==s:
    print(x-1,y)
else:
    print(x,y-1)

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

if U == S:
  print(A - 1, B)
elif U == T:
  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)
else:
    print(A,B-1)

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

if s == u:
    a -= 1
elif t == u:
    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(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:
    print(a - 1, b)
else:
    print(a, b - 1)

Solution (Python):
a = input()
aa = a.split()

b = input()
bb = b.split()
b0 = int(bb[0])
b1 = int(bb[1])

c = input()

if c == aa[0]:
    b0 -= 1
else:
    b1 -= 1
    
print(b0,b1)

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 = [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(A,B)

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

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

Solution (Python):
colors = list(input().split(" "))
cnt = list(map(int,input().split(" ")))

s = input()
if s == colors[0]:
    cnt[0] -=1
else:
    cnt[1] -=1
print(" ".join(map(str,cnt)))

Solution (Python):

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

Solution (Python):
def solve(s, t, a, b, u):
    t = s == u
    return "%d %d" % (a - t, b - 1 + t)

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

Solution (Python):
from collections import OrderedDict as dict
d = dict(zip(input().split(), map(int, input().split())))
d[input()] -= 1
print(*d.values())

Solution (Python):
from collections import OrderedDict as dict
d = dict(zip(input().split(), map(int, input().split())))
d[input()] -= 1
print(*d.values())

Solution (Python):
s,t=input().split()
a,b=map(int,input().split())
c=input()
d=" "
if s==c:
  print("{}""{}""{}".format(a-1,d,b))
else:
  print("{}""{}""{}".format(a,d,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(a, b)

Solution (Python):
s, t = list(input().split())
s_num, t_num = map(int, input().split())
bad_string = input()

if bad_string == s:
    print(s_num - 1, t_num)
elif bad_string == t:
    print(s_num, t_num - 1)
else:
    print(s_num, t_num)

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

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

Solution (Python):
ball_1,ball_2 = input().split()
ball_1_count,ball_2_count = map(int , input().split())
getted_str = input()
if getted_str == ball_1:
    ball_1_count -= 1
else:
    ball_2_count -= 1
print(str(ball_1_count) + " " + str(ball_2_count))

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

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
s2 = input()
if s == s2: 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(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
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:
    print(str(a-1)+" "+str(b))
else:
    print(str(a)+" "+str(b-1))

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

if S==U:
    print(s-1,t)
elif T==U:
    print(s,t-1)

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

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

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 = list(map(str, input().split()))
A, B = list(map(int, input().split()))
U = str(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 s==u:
  print(a-1,b)
elif t==u:
  print(a,b-1)

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

Solution (Python):
import sys
stdin = sys.stdin
from collections import deque

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

s, t = list(map(str, stdin.readline().split()))
a, b = na()
u = ns()
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:
    A-=1
else:
    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 = A - 1
elif U == T:
    B = B - 1
print(A,B)