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()
a = int(a)
b = int(b)
u = input()

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

Solution (Python):
a = [i for i in input().split()]
nums = [int(i) for i in input().split()]
thr = input()
if(thr == a[0]):
	nums[0] -= 1
else:
	nums[1] -= 1
print(nums[0],nums[1])

Solution (Python):
def main():

    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    if U == S:
        return " ".join(map(str, [A-1, B]))
    else:
        return " ".join(map(str, [A, B-1]))

if __name__ == '__main__':
    print(main())

Solution (Python):

from collections import OrderedDict
d = OrderedDict()
a = list(input().split())
b = list(map(int, input().split()))
for i in range(2):
	d[a[i]] = b[i]
d[input()] -= 1
print(*d.values())

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

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

A, B = [int(x) for x in input().split()]

U = input()

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

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

print(a, b)

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

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

Solution (Python):
s,a,u=open(0)
i=u in s
print(int(a[:2])-1+i,int(a[2:])-i)

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


ans=[A,B]

if U==S:
    ans=[A-1,B]
else:
    ans=[A,B-1]


print(*ans)

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

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

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

Solution (Python):
S, T = 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

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

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

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

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

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

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

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

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

Solution (Python):
import math
import collections

def main():
  S, T = input().split()
  A, B = map(int, input().split())
  U = input()
  
  if U == S:
    print(A-1, B)
  else:
    print(A, B-1)
  
  
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):
lst = input().split()
ab = list(map(int, input().split()))
ab[lst.index(input())] -= 1
print(str(ab[0]) + ' ' + str(ab[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(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 = 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)
elif T==U:
    print(A, B-1)
else:
    print(A, B)

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

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

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

print(A,B)

Solution (Python):
s, t = 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(a)for a in input().split()]
c = input()
if c==s:
  print(a-1,b)
elif c==t:
  print(a,b-1)

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

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 = input().split()
t = list(map(int,input().split()))
d = {s[0]:t[0],s[1]:t[1]}
d[input()]-=1
print(d[s[0]], d[s[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:
  print(A - 1, B)
else:
  print(A, B - 1)

Solution (Python):

(s,t,),(a,b,),(u,)=[t.split() for t in open(0)]
print(int(a)-(s==u),int(b)-(t==u))

Solution (Python):
x, t = input().split()
a, b = map(int, input().split())
u = input()
dic = {x:a, t:b}

for i in dic.keys():
  if i == u:
    dic[i] -= 1

print(dic[x], dic[t])

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(str(a)+' '+str(b))

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

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

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

if s==u:
    a-=1

if t==u:
    b-=1
print('%d %d' % (a, b))

Solution (Python):


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

dic = {s:a, t:b}

dic[u] = dic[u] - 1

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

Solution (Python):
red, blue = input().split()
red_num, blue_num = list(map(int, input().split()))
s = input()

if s == red:
    red_num -= 1
elif s == blue:
    blue_num -= 1

print(str(red_num) + ' ' + str(blue_num))

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

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

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

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

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

print(a,b)

Solution (Python):
Ss, Ts = input().split()
A, B = map(int, input().split())
Us = input().rstrip()

if Ss == Us:
    A -= 1
elif Ts == Us:
    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):
a,b=map(str,input().split())
c,d=map(int,input().split())
e=input()
if a==e:
    c=c-1
else:
    d=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
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:
    A -= 1
    l = [A,B]
    print(' '.join(map(str,l)))
elif T == U:
    B -= 1
    l = [A, B]
    print(' '.join(map(str, l)))

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

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):
x = dict()
s,t = input().split()
n,m = map(int, input().split())
x[s] = n
x[t] = m
p = input()
x[p] -= 1
print(x[s], x[t])

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

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

if S == U:
    A -= 1
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)

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

Solution (Python):
mod = 1e9+7
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
    A, B = [x for x in raw_input().split()]
    
    A_cnt, B_cnt = [int(x) for x in raw_input().split()]
    
    throw_away = raw_input()
    
    if throw_away == A:
        A_cnt -= 1
    else:
        B_cnt -= 1
    
    print(str(A_cnt) + " " + str(B_cnt))
    

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):
s, t = input("").split(" ")
a, b = [int(i) for i in input("").split(" ")]
u = input("")
if(s == u):
    a -= 1
elif(t == u):
    b -= 1
print(f"{a} {b}")

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

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

Solution (Python):
s,t,a,b,u=open(0).read().split()
if s==u:
    print(int(a)-1,b)
elif t==u:
    print(a,int(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())
c = input()
if c == 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):
s, t = map(str, input().split())
a, b = map(int, input().split())
inp = input()
if inp==s:
  print(a-1,b)
else:
  print(a,b-1)

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

Solution (Python):
a,b = map(str, input().split())
one,two = map(int, input().split())
dis = input()

if dis == a: print(one-1, two)
else: print(one, two-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):
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))
    else:
        print(str(a) + ' ' + str(b - 1))
main()

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

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

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


if __name__ == "__main__":
    main()

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("{} {}".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:
    print(A-1, B)
else:
    print(A, B-1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()
print(A-1, B) if S == U 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,A,B,U = open(0).read().split()

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

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

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

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

Solution (Python):
l1=input().split()
l2=list(map(int,input().split()))
l2[l1.index(input())]-=1
print(" ".join(str(x) for x in l2))

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, end = " ")
print(b)

Solution (Python):
S,T=input().split()
A,B=map(int,input().split())
U=input()
if U==S:
    print(A-1,B)
if 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:
    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 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)
elif u == t:
  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(str(A) + ' ' + str(B))

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7) 
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque


from collections import Counter

from itertools import accumulate,combinations,permutations

from heapq import heapify,heappop,heappush


from functools import lru_cache

from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    

    
    S,T=input().split()

    A,B = map(int, input().split())
    
    
    
    s=input()
    if s==S:
        print(max(0,A-1),B)
    else:
        print(A,max(B-1,0))





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

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

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

if __name__ == '__main__':
    solve()

Solution (Python):
s, t = map(str, input().split())
a, b = map(int, input().split())
u = str(input())
sums = 0
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=map(str,input().split())
A,B=map(int,input().split())
U=str(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 = 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,t = input().split()

cnt = {}
cnt[s], cnt[t] = map(int, input().split())
u = input()
cnt[u]-=1

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

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

print(a,b)

Solution (Python):

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

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

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

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

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

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

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

Solution (Python):
S, M = map(str,input().split())
A, B = map(int,input().split())
U = str(input())
if U == S:
    print(A - 1, B)
elif U == M:
    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
  b=0
else:
  a=0
  b=1

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

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

print(A, B)

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


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

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

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

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

Solution (Python):
w = list(input().split())
n = list(map(int, input().split()))
u = input()

if u == w[0]:
  print(n[0]-1,n[1])
else:
  print(n[0],n[1]-1)

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

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

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

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

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

def II(): return str(input())
def MI(): return map(int,input().split())
def MI2(): return map(str,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    S, T = MI2()
    A, B = MI()
    U = II()
    
    if U == S:
        A = A-1
    elif U == T:
        B = B-1
    
    print(A, B)

if __name__ == "__main__":
	main()

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

if __name__=="__main__":
    main()

Solution (Python):
l = list(input() for _ in range(3))
str1 , str2 = l[0].split()
num1 , num2 = map(int,l[1].split())
if l[2] == str1:
  num1 -= 1
  print(num1 , num2)
else:
  num2 -= 1
  print(num1 , num2)

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

Solution (Python):



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

balls = {}
balls[s] = a
balls[t] = b
balls[u] = balls[u] - 1

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

Solution (Python):
print(' '.join((lambda x:[str((x[2]-1)) if x[4] == x[0] else str(x[2]),str((x[3]-1)) if x[4] == x[1] else str(x[3])])(input().split()+list(map(int,input().split()))+[input()])))

Solution (Python):


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

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

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

Solution (Python):
s,t=list(input().split())
a,b=list(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 = input()

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

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

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

print(a,b)

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

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

if A==C:
    print(X-1,Y)
else:
    print(X,Y-1)

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

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

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

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)

if __name__ == '__main__':
    main()

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

Solution (Python):

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

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

Solution (Python):
s, t = 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):
def main():
    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)

if __name__ == "__main__":
    main()

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

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

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

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

print(a, b)

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

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

Solution (Python):
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()
if u == s: a-=1
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(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):
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    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)


if __name__ == '__main__':
    solve()

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)