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):
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans



s,t = list(map(str, 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
else:
    b -= 1

print(a, b)

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

Solution (Python):
st = input().split()
ab = input().split()
u = input()
if u == st[0]:
 print(int(ab[0])-1,int(ab[1]))
else:
 print(int(ab[0]),int(ab[1])-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(str(A) + " " + str(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):
a,b = map(str, input().split())
c,d = map(int, input().split())
e = input()
if e == a:
  c-=1
else:
  d-=1
print('%s %s' % (c, d))

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

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

Solution (Python):
from sys import stdin

s, t = stdin.readline().rstrip().split()
a, b = [int(x) for x in stdin.readline().rstrip().split()]
u = input()

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

Solution (Python):
x_name, y_name = input().split()
x_sum, y_sum = (int(x) for x in input().split())
z = input()
if x_name == z:
  x_sum -= 1
elif y_name == z:
  y_sum -= 1
print(str(x_sum) + " " + str(y_sum))

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

Solution (Python):
A,B = input().split()
n_A, n_B = input().split()
num_A = int(n_A)
num_B = int(n_B)
C = input()
if C == A:
  num_A = num_A -1
if C == B:
  num_B = num_B -1
print(num_A, num_B)

Solution (Python):
st = input().split()
ab = list(map(int, input().split()))
u = input()
ab[st.index(u)] -= 1
print(ab[0],ab[1])

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 = [int(num) for num in input().split()]
U = (input())
if S == U:
    print("{} {}".format(A-1, B))
else:
    print("{} {}".format(A, B-1))

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

aa, bb = map(int, input().split())

set = input()

if set == a:
    aa -= 1
else:
    bb -= 1

print(str(aa) + " " +str(bb))

Solution (Python):


str_1,str_2 = input().split()
str_1_count,str_2_count = input().split()
del_str = input()
if del_str == str_1:
    str_1_count = int(str_1_count) - 1
else:
    str_2_count = int(str_2_count) - 1

print(str(str_1_count) +" " + str(str_2_count))

Solution (Python):
S,T = input().split()
s_num,t_num = (int(x) for x in input().split())
U = input()

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

print(str(A)+ ' ' +str(B))

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(a,b)

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

Solution (Python):
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007



def main():
	a, b = input().split()
	v,w = IN()
	ss=input()
	if ss == a:
		v=v-1
	else:
		w=w-1
		
	print(str(v)+' '+str(w))
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Solution (Python):
import sys

Ball = list(map(str, input().split()))
Quantity = list(map(int,input().split()))
U = str(input())

S = Ball[0]
T = Ball[1]
A = Quantity[0]
B = Quantity[1]

if not 1 <= len(S) or not len(S) <= 10:
    print("error:S_length")
    sys.exit()    
if not 1 <= len(T) or not len(T) <= 10:
    print("error:T_length")
    sys.exit()   
if S == T:
    print("error:S==T")
    sys.exit()
if S != U and T != U:
    print("error:S=U or S=T")
    sys.exit()
if not 1<= A or not B <= 10:
    print("error:A,B")
    sys.exit()

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:
  A = A - 1
else:
  B = B - 1
print(A, B)

Solution (Python):
a,b = input().split()
a_num, b_num = map(int, input().split())
x = input()

if x==a :
    a_num = a_num - 1
else:
    b_num = b_num - 1

print(str(a_num) + " " + str(b_num))

Solution (Python):
r,b = input().split()
num1,num2 = map(int,input().split())
u = input()
a = num1
b = num2
if u == r:
    a = num1-1
else :
    b = num2-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(A, B)

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

if u == s[0]:
    print(a[0]-1, a[1])
else:
    print(a[0], a[1]-1)

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

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

print(str(A) + " " + str(B) )

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

Solution (Python):
n, k=input().split()
l, m= map(int, input().split())
o = input()
if n==o:
	l = l-1
if k == o:
	m = m-1
print(l,m)

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

Solution (Python):
ball_name1,ball_name2 = input().split(" ")
ball1,ball2 = input().split(" ")
ball1 = int(ball1)
ball2 = int(ball2)
ball_chosen = input()


if (ball_chosen in ball_name1) :
    ball1-=1
    print(str(ball1)+" "+str(ball2))
else:
    ball2-=1
    print(str(ball1)+" "+str(ball2))

Solution (Python):
col = input().split()
num = list(map(int, input().split()))
col2 = input()

if col[0] == col2:
  print(num[0] - 1, num[1])
elif col[1] == col2:
  print(num[0], num[1] - 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, sep=' ')

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

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

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

if e == a: c-= 1
elif e == b: d -= 1

print(c, d)

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 =  [str(x) for x in 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,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:
  a-=1
else :
  b-=1
print(str(a)+" "+str(b))

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

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

Solution (Python):
S , T =  [str(x) for x in 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,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 = 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()
a, b = map(int, input().split())
u = input()
if u == t:
    print(a, b-1)
if u == s:
    print(a-1, b)

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

    temp1 = s.count(s)
    temp2 = t.count(t)
    temp3 = u.count(u)
    temp1 = a
    temp2 = b
    if u == s:
        a = temp1 - temp3
        print(a, b)
    elif u == t:
        b = temp2 - temp3
        print(a, b)
    else:
        pass


remaining_balls()

Solution (Python):

import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    print(str(A-1) + " " + str(B) if U == S else str(A) + " " + str(B-1))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    T = next(tokens)  
    A = int(next(tokens))  
    B = int(next(tokens))  
    U = next(tokens)  
    solve(S, T, A, B, U)

if __name__ == '__main__':
    main()

Solution (Python):
p=[input() for i in range(3)]
col=list(map(str, p[0].split()))
cnt=list(map(int, p[1].split()))
c_del=p[2]
if c_del in col:
    ball=cnt[col.index(c_del)]
    del cnt[col.index(c_del)]
    ball-=1
    cnt.insert(col.index(c_del),ball)
print(' '.join(map(str,cnt)))

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

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

print(a)
print(b)

Solution (Python):
i = input().split()
j = list(map(int, input().split()))
k = input()
if k==i[0]:
    j[0]=j[0]-1
else:
    j[1]=j[1]-1
print(j[0], j[1])

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

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S, T = readline().split()
A, B = map(int, readline().split())
U = read().rstrip()

if S == U:
    A -= 1
else:
    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):
a,b = map(str,input().split())
c,d = map(int,input().split())
n = input()
if n == a:
    print(str(c-1)+" "+str(d))
else:
    print(str(c) + " " + str(d-1))

Solution (Python):
S = input().split()
A = list(map(int, input().split()))
Z = input()
 
if S[0] == Z:
  X = A[0] - 1
  Y = A[1]
  print("{} {}".format(X, Y))
if S[1] == Z:
  X = A[0]
  Y = A[1] - 1
  print("{} {}".format(X, Y))

Solution (Python):
d1 = input().split()
d = input().split()
d3 = input()
d2 = [int(x) for x in d]

if d1[0]==d3:
    d2[0]-=1
elif d1[1]==d3:
    d2[1]-=1


for x in d2:
    print(x)

Solution (Python):
input_lines = input().split()
numbers = list(map(int,input().split()))
line = input()

if line == input_lines[0]:
    numbers[0] -= 1
else :
    numbers[1] -= 1

numbers = list(map(str,numbers))
print(numbers[0] + ' ' + numbers[1])

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

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

if S == U:
  A = int(A) - 1
elif T == U:
  B = int(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()
balls = {S:A,T:B}
balls[U] = balls[U] - 1
print(balls[S], balls[T])

Solution (Python):

 
cmdvar_str=input()
cmdvar_num=input()
strchois=input()
str_splited=cmdvar_str.split()
num_splited=cmdvar_num.split()

if strchois == str_splited[0]:
    print(int(num_splited[0])-1,num_splited[1])
if strchois == str_splited[1]:
    print(num_splited[0],int(num_splited[1])-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("%d %d" % (A, B))

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

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

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

print(A,' ',B,sep='')

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

s_count = A
t_count = B

if(U == S):
  s_count -= 1
else:
  t_count -= 1
  
print(s_count)
print(t_count)

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

Solution (Python):
s, t = map(str, input().lower().split())
a, b = map(int, input().lower().split())
u = input()
dicts = {}
dicts.update([(s,a),(t,b)])
dicts[u] = dicts[u] - 1
print("%d %d" %(dicts[s], dicts[t]))

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

print(-(s==u)+a,-(t==u)+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):
strArr = input().split()
numArr = input().split()
nums = [int(s) for s in numArr]
which = input()
if (which == strArr[0]):
  print(str(nums[0] - 1) + " " + str(nums[1]))
else:
  print(str(nums[0]) + " " + str(nums[1] - 1))

Solution (Python):
c1,c2 = input().split()
a1,a2 = input().split()
tem = input()
a1 = int(a1)
a2 = int(a2)
if tem == c1:
   a1 = a1-1
else:
   a2 = a2 -1

print(str(a1)+" "+ str(a2))

Solution (Python):
ball_name1,ball_name2 = input().split(" ")
ball1,ball2 = input().split(" ")
ball1 = int(ball1)
ball2 = int(ball2)
ball_chosen = input()


if (ball_chosen in ball_name1) :
    ball1-=1
    print(str(ball1)+" "+str(ball2))
else:
    ball2-=1
    print(str(ball1)+" "+str(ball2))

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

Solution (Python):
a = input().split()
b = input().split()
c = input()
if c == a[0]:
  b[0] = int(b[0])-1
elif c == a[1]:
  b[1] = int(b[1])-1
j = ""
for i in b: 
  j = j + " " + str(i)
print(j)

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 = input().split() 
u = input()


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

print(a+' '+b)

Solution (Python):
s, t = input().split()
x, y = map(int, input().split())
query = input()
if query == s:
    x -= 1
else:
    y -= 1
print("{} {}".format(x, y))

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

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

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

print(A, B)

Solution (Python):
a,b = input().split()
n,m = list(map(int,input().split()))
k=input()
print(n-(a==k),m-(b==k))

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):
a,b = input().split()
A,B = input().split()
c = input()
a = str(a)
b = str(b)
A = int(A)
B = int(B)
c = str(c)
d = A - 1
D = B - 1
if c == a:
    print(d,B)
elif c == b:
    print(A,D)

Solution (Python):
S,T = (str(x) for x in input().split())
A,B = (int(x) for x in input().split())
U = str(input())
if U == S:
    A = A -1
else:
    B = 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 = 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):
strl = input().split()
qty = list(map(int, input().split()))
str = input()

if strl[0] == str:
    qty[0] = qty[0] - 1
else:
    qty[1] = qty[1] - 1

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

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

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):
li = input().split()
count = input().split()
ch = input()

for i in range(len(li)):
  if li[i] == ch:
    count[i] = int(count[i]) - 1
  else:
    count[i] = int(count[i])
    
print(count[0],count[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 U == S:
  A -= 1
else:
  B -= 1

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

Solution (Python):
s, t = input().split()
s_val, t_val = map(int, input().split())
key_name = input()
if key_name == s:
    s_val -= 1
else:
    t_val -= 1
print(s_val, t_val)

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 = input().split()
num = [int(x) for x in input().split()]
A = input()
 
if A == S[0]:
  num[0]=num[0]-1
else:
  num[1]= num[1]-1
  
print(str(num[0])+" "+str(num[1]))

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

Solution (Python):
a, b=map(str,input().split())
c, d=map(int,input().split())
e=input()
f=str(e)
if a==f:
  print(c-1,d)
else:
  print(c,d-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 = input().split()
i = list(map(int, input().split()))
a=input()
if a==s[0]:
  i[0]-=1
elif a==s[1]:
  i[1]-=1
print(i[0],i[1])

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("{} {}".format(a,b))

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


resolve()

Solution (Python):


s, t= [""] * 2
a, b = [0] * 2
u = [""]

def format_input(filename = None):
	global s,t
	global a,b
	global u
	if filename == None:
		s, t = list(map(str, input().split()))
		a, b = list(map(int, input().split()))
		u = list(map(str, input().split())).pop()

def get_answer():
	answer = [a, b]
	if u == s:
		answer[0] -= 1
	else:
		answer[1] -= 1

	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans[0], ans[1])

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 u == s:
  a -= 1
elif u == t:
  b -= 1
print('{0} {1}'.format(a,b))

Solution (Python):



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

if __name__=='__main__':
  main()

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

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

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

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

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


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

Solution (Python):
a,b = map(str,input().split())
a_num,b_num = map(int,input().split())
change = input()
if a == change:
    a_num = a_num - 1
else:
    b_num = b_num - 1
print(str(a_num)+" "+str(b_num))

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

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

Solution (Python):

s = input().split()
n = list(map(int,input().split()))
s2 = input()

if s[0] == s2:
  n[0] = n[0] - 1
else:
  n[1] = n[1] - 1

print(str(n[0]) +' '+str(n[1]))

Solution (Python):
r1 = input().split(" ")
s = r1[0]
t = r1[1]
r2 = list(map(int,input().split(" ")))
a = r2[0]
b = r2[1]
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 = [int(i) for i in input().split()]
U = input()

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

print(A, B)

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

Solution (Python):
s, t = map(str,input().split())
num_s, num_t = map(int,input().split())
del_target = input()


data  = {s:num_s,t:num_t}
data[del_target] = data[del_target]-1

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

Solution (Python):


"""
Created on Sun Feb  9 20:19:26 2020

@author: W_Indicate
"""
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()
n,m = map(int,input().split())
u = input()

if u == s:
    n -= 1
elif u == t:
    m -= 1
else:
    print(-1)

print(n,m)

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

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

Solution (Python):
word_list = [i for i in input().split()]
num_list = [int(num) for num in input().split()]
ext_word = input()

check_dict = dict(zip(word_list, num_list))
check_dict[ext_word] -= 1

check_list = [str(check_dict[key_val]) for key_val in word_list]
print(check_list[0] + " " + check_list[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(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:
    print(a-1, b)
elif u == t:
    print(a, b-1)
else:
    print(a, b)

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

if U == ST[0]:
    AB[0] -= 1
else:
    AB[1] -= 1

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

Solution (Python):

s = input().split()


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


u = input()

if u == s[0]:
    a[0] -= 1
else:
    a[1] -= 1

print(str(a[0]),str(a[1]))

Solution (Python):
color = input().split()
num = input().split()
choice = input()

for i in range(2):
  num[i] = int(num[i])
  if color[i] == choice:
    num[i] = num[i] - 1
print(num[0], num[1])

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

    m = {s:a, t:b}
    m[u] -= 1
    print(m[s], m[t])

solve()

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

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

U = input()

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

Solution (Python):
def resolve():
    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))


if __name__ == "__main__":
    resolve()

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()
s,t = (int(x) for x in input().split())
U = input()
if(U == S):
    s= s-1
elif(U == T):
    t = t-1
print(s,t)

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:
  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()
cnt = {}
cnt[S] = A
cnt[T] = B
cnt[U] -= 1
print (cnt[S], cnt[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):



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

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