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):
S,T = input().split()
A,B = input().split()
U = input()

A = int(A)
B = int(B)


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):
S,T=map(str,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):
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):
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    s= list(input().split())
    a = list(map(int, input().split()))
    z = input()
    i = s.index(z)
    a[i] -= 1
    print(a[0])
    print(a[1])
    


main()

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):
a, b = input().split()
c, d = map(int, input().split())
e = input()

if a == e:
    print(c-1, d)

if b == e:
    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, t) = input().split()
a = input().split()
(n, m) = list(map(int, a))
u = input()
if u == s:
    print(n - 1, m)
elif u == t:
    print(n, m - 1)

Solution (Python):
S, T = input().split()
A, B = (int(x) for x in input().split())
print('%d %d' %(A-1, B) if input() == S else '%d %d' %(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 S == U:
    print(A-1, B)
else:
    print(A, B-1)

Solution (Python):
st = list(map(str,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 = 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):
C1,C2= map(str,input().split())
CN1,CN2= map(int,input().split())
ColorTaken = str(input())
if ColorTaken == C1 :
    print ( CN1 - 1 , CN2 )
else :
    print ( CN1 , CN2 - 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())
if input() == S:
  A -= 1
else:
  B -= 1
print(A,B)

Solution (Python):
i, j = input().split()
a, b = map(int, input().split())
k = input()
if k == i:
    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 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 s==u:
  a=a-1
elif t==u:
  b=b-1

print(a,b)

Solution (Python):
S,T=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):
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 = list(input().split())
a, b = map(int,input().split())
u = input()

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

d[u] -= 1

print('{} {}'.format(d[s], d[t]))

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

balls = {s : a, t: b}

u = input()

balls[u] -= 1

print("{} {}".format(balls[s], balls[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()
C = list(map(int,input().split()))
U = input()
if S == U:
  C[0] -= 1
else:
  C[1] -= 1
print("{} {}".format(C[0],C[1]))

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

Solution (Python):
S = input().split()
A = list(map(int,input().split()))
U = input()
a = S.index(U)
A[a] -= 1
print(A[0],A[1])

Solution (Python):

import sys


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



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):
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):
A = input()
a,b = (A.split(' '))
B = input()
c,d = (B.split(' '))
e = int(c)
f = int(d)
C = input()

if a == C:
    print('{} {}'.format(e-1,f))
else:
    print('{} {}'.format(e,f-1))

Solution (Python):
_S, _T = input().split()
A, B = list(map(lambda x:int(x), input().split()))
U = input()


if U == _S:
    is_type_A = True
else:
    is_type_A = False

if is_type_A:
    print(A - 1, B)
else:
    print(A, B-1)

Solution (Python):
str_a,str_b = input().split()
num_a,num_b = map(int, input().split())
kye_str = input()
if str_a == kye_str:
  num_a = num_a - 1
else:
  num_b = num_b - 1
print(str(num_a) + " " +str(num_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()
print(a-1,b) if u == s 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)
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, sep=' ')
elif(U == T):
    print(A, B - 1, sep=' ')

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 = [int(x) for x in 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 = A - 1
else:
	B = B - 1

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

Solution (Python):
import sys

stdin = sys.stdin

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

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

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

Solution (Python):
M = [input() for i in range(3)]
M[0] = M[0].split()
s = str(M[0][0])
t = str(M[0][1])

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

U = str(M[2])


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())
u = str(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 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=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):
stra, strb = [str(_) for _ in input().split()]
n1  , n2   = [int(_) for _ in input().split()]
strDel     = str(input())
if stra == strDel:
    print(n1-1, n2)
elif strb == strDel:
    print(n1, n2-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):
col1,col2=map(str,input().split())
no1,no2=map(int,input().split())
check=str(input())
if check==col1:
  print(no1-1,no2)
else:
  print(no1,no2-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 = list(input().split())
a,b = list(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 = 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 = input()

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

Solution (Python):
from sys import stdin

S, T = stdin.readline().rstrip().split()
A, B = [int(x) for x in stdin.readline().rstrip().split()]
U = stdin.readline().rstrip()

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 = 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 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()
balls = {s: a, t: b}
if u in balls.keys():
  balls[u] -= 1
print('{} {}'.format(balls[s], balls[t]))

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

Solution (Python):

import sys


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



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)  
    print(*solve(S, T, A, B, U))

if __name__ == '__main__':
    main()

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

Solution (Python):
inputST = input()
STlist = inputST.split(" ")
s = STlist[0]
t = STlist[1]

inputAB = input()
ABlist = inputAB.split(" ")
a = int(ABlist[0])
b = int(ABlist[1])

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()
print(a-1,b) if u==s 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):
def get_ints():
    return map(int, input().split())

s, t = input().split()
a, b = get_ints()
u = input()
if u == s:
    print(str(a - 1) + ' ' + str(b))
else:
    print(str(a) + ' ' + str(b - 1))

Solution (Python):
def main():

    s,t = map(str, input().split())

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

    u = str(input())

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


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

import sys

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

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

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

    return

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

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

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

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

Solution (Python):
list1 = input().split(" ")
list2 = input().split(" ")
U = input()
S = list1[0]
T = list1[1]
A = int(list2[0])
B = int(list2[1])

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

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

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

Solution (Python):
S, T = input().split(" ")
A, B = [int(i) for i in 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:
    A -= 1
else:
    B -= 1

print(A,B)

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

if U == X:
  print(A-1, end=' ')
  print(B)
else:
  print(A, end=' ')
  print(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, a, b, u = open(0).read().split()
d = {s:int(a), t:int(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:
    print(a-1,b)
else :
    print(a,b-1)

Solution (Python):
import sys
msg = sys.stdin.readlines()
a = []
for x in msg:
  for y in x.replace('\n', '').split(' '):
    a.append(y)
ind1 = a[0]
ind2 = a[1]
val1 = int(a[2])
val2 = int(a[3])
if ind1 == a[4]:
  val1 -= 1
else:
  val2 -= 1

print(val1, val2)

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

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

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

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


u = input()
if u == color[0]:
    a -= 1
elif u == color[1]:
    b -= 1
print(str(a) + ' ' + str(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):
a,b = map(str,input().split())
c,d = map(int,input().split())
e = input()
if a == e:
  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:
    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):
li = input().split()
a,b=map(int,input().split())
dec=input()
if li[0]==dec:
  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):
import sys
input = sys.stdin.readline

def main():
    S, T = input().strip().split()
    A, B = map(int, input().split())
    U = input().strip()
    if S == U:
        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 -= 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 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)

Solution (Python):
name_a,name_b=(str(x) for x in input().split())
a_count,b_count=(int(x) for x in input().split())
fetch_color=input()
ans,bns=0,0
if fetch_color==name_a:
  ans = a_count-1
  bns = b_count
elif fetch_color==name_b:
  bns = b_count-1
  ans = a_count
print(ans,bns)

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

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

i = list(map(int, input().split()))
A = i[0]
B = i[1]

U = input()

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

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

Solution (Python):
st = input().split()
AB = input().split()
U = input()
s = st[0]
t = st[1]
A = int(AB[0])
B = int(AB[1])

if s == U:
    A = A - 1

if t == U:
    B = B - 1

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

Solution (Python):
S,  T = input().split()
r, b = map(int, input().split())
N = input()
 
if S == N:
  r -= 1
elif T == N:
  b -= 1
  
 
print(r, 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:
  print(A-1,B)
else:
  print(A, B-1)

Solution (Python):
def main():
  S, T = input().split()
  A, B = list(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 = 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 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:
    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)
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)
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 = a-1
elif u == t:
  b = b-1

print(a,b)

Solution (Python):
def solve():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    ans = [A-1, B] if U == S else [A, B-1]
    print(*ans)

solve()

Solution (Python):
def solve():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    if U == S:
        A -= 1
    else:
        B -=1
    ans = [A, B]
    print(*ans)




solve()

Solution (Python):
a, b = input().split()
anum, bnum = map(int, input().split())
key = input()
if a == key:
  anum -= 1
else:
  bnum -= 1
print(anum, bnum)

Solution (Python):
def main():
    st = input().split()
    ab = list(map(int, input().split()))
    u = input()

    indx = st.index(u)
    ab[indx] -= 1
    a, b = ab
    print(a, b)


if __name__ == "__main__":
    main()

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

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

print(A, B)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
c = input()
if c == 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(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(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(A,B)

Solution (Python):
a=[str(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=input().strip()
x=b[0]
y=b[1]
if a[0]==c:
	b[0]=b[0]-1
elif a[1]==c:
	b[1]=b[1]-1

print(' '.join(map(str, 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 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 = A -1
if U == T:
  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 -= 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):
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:
    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 = map(str,input().split())
AM,BM = map(int,input().split())
ans = input()

if ans == A:
    AM -= 1
else:
    BM -= 1

print(AM,BM)

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 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
elif t==u:
  b -= 1
ans=[a,b] 

print(*ans)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s,t = input().split()
a,b = inpl()
w = input()
if s == w:
    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('{} {}'.format(A, B))

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

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

status = {s:a, t:b}

for k, v in status.items():
    if u == k:
        status[k] = status[k] - 1

print(str(status[s]) + ' ' + str(status[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())
if input() == 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
else:
  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 = 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 = input().split()
a,b = [int(x) for x in input().split()]
u = input()
if (s == u):
    a -= 1
else:
    b -= 1
print(a,b)

Solution (Python):
def main():
    st = list(map(str, input().split()))
    num = list(map(int,input().split()))
    u = str(input())
    if st[0]==u:
        num[0]-=1
    else:
        num[1]-=1
    print(num[0],num[1])

if __name__ == '__main__':
    main()

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

for i in range(2):
    if S[i] == U:
        X[i] -= 1

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