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 sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        
        
        lines.append(input())
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (s, t) = [e for e in lines[0].split(" ")]
    (a, b) = [int(e) for e in lines[1].split(" ")]
    u = lines[2]

    return (s, t, a, b, u)


def solve(s, t, a, b, u):
    
    a2 = a
    b2 = b
    if s == u:
        a2 = a2 - 1
    elif t == u:
        b2 = b2 - 1
    
    result = ' '.join([str(a2), str(b2)])

    return result
    


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Solution (Python):
s = list(input().split())
a = list(map(int, input().split()))
a[s.index(input())] -= 1
for i in a:
  print(i, end = ' ')

Solution (Python):
a = input().split()
b = [int(k) for k in input().split()]
c = input()

if a[0] == c:
  b[0] -= 1
else:
  b[1] -= 1

print('{0} {1}'.format(b[0],b[1]))

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

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

t1=input()

if t1==b:
    t+=-1
else:
    s+=-1
print(s,t)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s,t = LS()
    a,b = LI()
    u = S()
    d = defaultdict(lambda : 0)
    d[0] = a
    d[1] = b
    if s == u:
        d[0] -= 1
    else:
        d[1] -= 1
    print(d[0],d[1])
    return


if __name__ == "__main__":
    solve()

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(str(A)+" "+str(B))

Solution (Python):


import sys
import math

from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
sys.setrecursionlimit(1000000000)


def lcm(a, b):
    return (a * b) // gcd(a, b)



S, T = input().split()
A, B = mis()
U = 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:
  A=A-1
else:
  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:
    if t==u:
        print(a-1,b-1)
    else:
        print(a-1,b)
else:
    if t==u:
        print(a,b-1)
    else:
        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
elif U == T:
    B = B - 1

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

Solution (Python):
colors = input().split()
nums = list(map(int, input().split()))
remover = input()
index = colors.index(remover)
nums[index] -= 1
print("%s %s" % (nums[0], nums[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):


if __name__ == "__main__":
    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(str(A) + " " + str(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(str(A)+' '+str(B))

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


str1,str2=map(str,input().split())
int1,int2=map(int,input().split())
str3=str(input())


if str3==str1:
    int1-=1
elif str3==str2:
    int2-=1


print(int1,int2)

Solution (Python):


color=input().split()
num=list(map(int,input().split()))
b=input()

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

Solution (Python):


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


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

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

if a == s:
    print(an-1,bn)
else:
    print(an,bn-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().strip().split()
A, B = map(int, input().strip().split())
U = input().strip()
if U==S:
	print(A-1, B)
elif U==T:
	print(A, B-1)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S, T = input().split()
A, B = MAP()
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("{} {}".format(A,B))

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

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

print(A,B)

Solution (Python):
a = input().split()
b = [int(k) for k in input().split()]
c = input()

if a[0] == c:
  b[0] -= 1
else:
  b[1] -= 1

print('{0} {1}'.format(b[0],b[1]))

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

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

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

print(A, B)

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

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

reduce = str(input())

for i in range(2):
  if colors[i] == reduce:
    nums[i] -= 1

print(*nums)

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):
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):
val = input().split(' ')
s = val[0]
t = val[1]

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

u = input()

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

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

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

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

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

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

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

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

Solution (Python):
i1 = input()
i2 = input()
i3 = input()

s = i1.split(' ')[0]
t = i1.split(' ')[1]
a = int(i2.split(' ')[0])
b = int(i2.split(' ')[1])
if(i3 == s):
    a -= 1
else:
    b -= 1
print(' '.join([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()
res = {
    s: a,
    t: b
}
res[u] -= 1
print(res[s], res[t])

Solution (Python):
dic = {}
s, t = input().split()
a, b = input().split()
u = input()
x = int(a)
y = int(b)
if s == u:
    x-=1
elif t == u:
    y-=1
print(x, y)

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

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

U = input()

if U == S:
	print(str(a-1)+" "+str(b))
	
else:
	print(str(a)+" "+str(b-1))

Solution (Python):
list_input = [input() for i in range(3)]

S_and_T = list_input[0].split(' ')
S = S_and_T[0]
T = S_and_T[1]

A_and_B = list_input[1].split(' ')
A = int(A_and_B[0])
B = int(A_and_B[1])

U = list_input[2]

if   U == S:  A -= 1
elif 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(str(A) + ' ' + str(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):
a=input()
S,T=a.split()[0],a.split()[1]
a=input()
A,B=int(a.split()[0]),int(a.split()[1])
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
else:
  d -= 1
print(str(c)+" "+str(d))

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

if a[0] == c:
    b[0] = b[0] - 1
else:
    b[1] = b[1] - 1

i = 0
while i <= 1:
    print(b[i], end =' ')
    i = i +1

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

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

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

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

Solution (Python):


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

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

e = str(input())

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

print("{} {}".format(c, d))

Solution (Python):
if __name__ == '__main__':
    s = input()
    a = s.split(" ", )
    c, d = map(int, input().split())
    f = input()
    if f  == a[0]:
        c = c-1
    else:
        d = d-1
    print(str(c)+" "+str(d))

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

a = a - 1 if u == s else a
b = b - 1 if u == t else b
print('{} {}'.format(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):
s, t = input().split()
num = list(map(int, input().split()))
u = input()

if u == s:
  nums = num[0] -1
  numt = num[1]
else:
  nums = num[0]
  numt = num[1] -1

l = str(nums) + " " + str(numt)
print(l)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,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 operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





s,t=input().split()
a,b=mii()
u=ss()

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

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

Solution (Python):
s = input().split()
i = list(map(int,input().split()))
u = input()
if s[1] == u:
  print(str(i[0]) +" "+ str(i[1]-1))
else:
  print(str(i[0]-1) + " " + str(i[1]))

Solution (Python):
rb = input().split()
r = rb[0]
b = rb[1]
AB = input().split()

A = int(AB[0])
B = int(AB[1])

U = input()

if r == U:
  A -= 1
elif b == U:
  B -= 1

print(A,B)

Solution (Python):
def resolve_A():
    s1, s2 = input().split()
    n1, n2 = input().split()
    s = input()
    if s == s1:
        n1 = int(n1) - 1
    else:
        n2 = int(n2) - 1
    print(str(n1) + " " + str(n2))
resolve_A()

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

if take == S:
  print(sn-1, tn)
else:
  print(sn, tn-1)

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

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

Solution (Python):
st = input()
ab = input()
u = input()

s = st.split(' ')[0]
t = st.split(' ')[1]

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


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

print(a,b)

Solution (Python):
S,T = input().split()
s_num,t_num = map(int,input().split())
U = input()
if S==U:
    print(str(s_num-1)+" "+str(t_num))
else:
    print(str(s_num)+" "+str(t_num-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 = input()
if s == u:
    a = int(a) - 1
if t == u:
    b = int(b) - 1
print(str(a)+' '+str(b))

Solution (Python):

def main():
    StringS,StringT = input().split();
    StringA,StringB = input().split();
    StringU = input();

    wkA=int(StringA);
    wkB=int(StringB);
    if StringU == StringS :
        wkA = wkA - 1;
    else:
        wkB = wkB - 1;
    print(wkA);
    print(wkB);

main()

Solution (Python):
S,T = input().split()
ans = list(map(int, input().split()))
c = input()

if c == S:
  ans[0] -= 1
else:
  ans[1] -= 1
print(*ans)

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

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

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

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

print(str(a) + ' ' + str(b))

Solution (Python):
import sys
input = sys.stdin.readline

color = input().split()
a = list(map(int, input().split()))
c = input().strip()
for i, color in enumerate(color):
    if color == c:
        a[i] -= 1

a = list(map(str, a))
print(' '.join(a))

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




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

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

Solution (Python):


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

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




print(a,b)

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

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

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

Solution (Python):

import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    dictionary = {S: A, T: B}
    dictionary[U] = dictionary[U] - 1
    print("{0} {1}".format(dictionary[S], dictionary[T]))
    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)
elif t == u:
    print(a, b-1)
else:
    print(a, b)

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

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

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

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)
elif U == T:
    print(A, B-1)
else:
    print('Invalid string.')

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
from collections import defaultdict

IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())

s=list(IAS())
n=list(IA())
u=input()

for i in range(0,2):
    if s[i]==u:
        n[i]-=1
print(str(n[0])+" "+str(n[1]))

N=int(100005)
a=[int(0) for i in range(N)]

Solution (Python):
a = input().split(" ")
b = list(map(int, input().split(" ")))
c = input()
if (a[0] == c):
  print("{0} {1}".format(b[0]-1, b[1]))
elif (a[1] == c):
  print("{0} {1}".format(b[0], b[1]-1))

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

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

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("{} {}".format(A,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 = map(str, input().split())
na, nb = map(int, input().split())
c = input()

dict = {a:na, b:nb}
dict[c] -=1

print('{0} {1}'.format(dict[a], dict[b]))

Solution (Python):
a, b = map(str, input().split())
n_a, n_b = map(int, input().split())
s_u = str(input())
s_a = 1 if a == s_u else 0
s_b = 1 - s_a
out = "{0} {1}".format(n_a - s_a, n_b - s_b)
print(out)

Solution (Python):
class Ball():
    def __init__(self, S: str, T: str, A: int, B: int):
        self.S = S
        self.T = T
        self.A = A
        self.B = B

    def select_ball(self, U: str):
        if self.S == U:
            self.A -= 1
        else:
            self.B -= 1
        return

    def remain_balls(self):
        print(self.A, self.B)


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

ball = Ball(S, T, A, B)
ball.select_ball(U)
ball.remain_balls()

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

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

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

import numpy as np

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

Solution (Python):

input_line = input()
S,T = input_line.split(" ")
input_line = input()
tmpA,tmpB = input_line.split(" ")
Sval = int(tmpA)
Tval = int(tmpB)
U = input()

if(U == S):
  Sval = Sval - 1
elif(U == T):
  Tval = Tval - 1
print(Sval,Tval)

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

if u == s:
    print(s_num - 1, t_num)
else:
    print(s_num, t_num- 1)

Solution (Python):
def Main(S, T, A, B, U):
    if(U == S):
        return str(A-1) + " " + str(B)
    else:
        return str(A) + " " + str(B-1)

def main():
    S, T = list(map(str, input().split()))
    A, B = list(map(int, input().split()))
    U = str(input())
    print(Main(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)
else:
	print(a, b)

Solution (Python):
def average_length(s, t, a, b, u):
    if u == s:
        return str(a - 1) + ' ' + str(b)
    elif u == t:
        return str(a) + ' ' + str(b - 1)
    return

if __name__ == "__main__":
    s, t = map(str, input().split())
    a, b = map(int, input().split())
    u = input()
    print(average_length(s, t, a, b, u))

Solution (Python):
Input1 = input().split(" ")
Input2 = input().split(" ")
Input3 = input()
Dict = {}
Dict[Input1[0]] = int(Input2[0])
Dict[Input1[1]] = int(Input2[1])
Dict[Input3] -= 1
print("{0} {1}".format(Dict[Input1[0]],Dict[Input1[1]]))

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

import sys


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


if __name__ == "__main__":
    main()

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("%d %d"%(A,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(A, B)

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

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

Solution (Python):
def main():
    A=[0]*3
    B=[0]*3
    for i in range(3):
        if i==1:
            A[i],B[i] = map(int,input().split())
        elif i==0:
            A[i],B[i] = input().split()
        else:
            A[i]=input()
    
    if A[2]==A[0]:
        A[1]-=1
    else:
        B[1]-=1
    print(A[1],B[1])

    
main()

Solution (Python):
s1,s2=input().split()
count1,count2=map(int,input().split())
s3=input()

if s1==s3:
    count1-=1
if s2==s3:
    count2-=1
print(count1,count2)

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

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

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

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

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

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

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

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

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

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

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

dct = {S:A, T:B}
dct[U] = dct[U] - 1
print(dct[S], dct[T])

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

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

print(A,B)

Solution (Python):

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

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

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

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

Solution (Python):


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

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

print("{} {}".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 = input().split()
A, B = input().split()
U = input()

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

Solution (Python):
s , t = [str(i) for i in input().split()]
a , b =[int(i) for i 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 = input().split()
A = int(A)
B = int(B)
U = input()
if(U==S):
    A-=1
elif(U==T):
    B-=1
    pass
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=list(map(str,input().split()))
a,b=list(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 = input()
if U == S:
  A = A-1
else:
  B = B-1
print(A, 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):
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

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

Solution (Python):
words = input().split(" ")
numbers_input = input().split(" ")
numbers = []
for i in numbers_input:
  numbers.append(int(i))
u = input()
for i, word in enumerate(words):
  if word == u:
    numbers[i] -= 1

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

Solution (Python):
def main():
  A, B = map(str, input().split())
  a, b = map(int, input().split())
  T = str(input())

  if(A == T):
    a -= 1
  else:
    b -= 1
  print(a, b) 
if __name__ == "__main__":
  main()

Solution (Python):
s,t = input().split()
a,b = map(int,input().split())
u = input()
if s == u:
    l = [a-1,b]
elif t == u:
    l = [a,b-1]
else:
     l = [a,b]
print(' '.join(map(str, l)))

Solution (Python):
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

ST = read_str()
S, T = list(ST.split())
AB = read_int()
A, B = AB
U = read_str()

def solve():
    ans = 0
    if S == U:
        print(A - 1, B)
    else:
        print(A, B - 1)
    return A, B

if __name__ == "__main__":
    solve()

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

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

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