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):
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().split()

if S==U[0]:
	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(str(a-1) + " " + str(b))
else:
	print(str(a) + " " + str(b-1))

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

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

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

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

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

if (e == a[0]): c -= 1
else: d -= 1

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

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 = (int(x) for x in input().split())
u = input()

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

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

if li[1] == U:
    B -= 1
    print(A,B)
else:
    A -= 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):
A, B = input().split()
L  = list(map(int, input().split()))
C = input()

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

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

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

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

Solution (Python):
i1, i2 = input().split()
j1, j2 = map(int,input().split())
k = input()

if k == i1:
  j1 -= 1
else:
  j2 -= 1
  
print(str(j1), str(j2))

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

dic = {s:a,t:b}

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)
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
elif U == T:
    B -= 1

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

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

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

h1[u] = h1[u] - 1

print(h1[s],h1[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):
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())
dicts = {}
dicts[s], dicts[t] = a, b
u = input()
dicts[u] -= 1
print(dicts[s], dicts[t])

Solution (Python):
S, T = input().split()
X = {}
X[S], X[T] = [int(_) for _ in input().split()]

U = input()
X[U] -= 1

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

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

Solution (Python):
T,S = input().split()
A,B = map(int,input().split())
U = input()
Z = [A+[0,-1][U == T],B+[0,-1][U == S]]
O = map(str,Z)
agy = ' '.join(O)
print(agy)

Solution (Python):
l = input().split()
m, n = list(map(int, input().split()))
s = input()
if s == l[0]:
    a = m - 1
    print(a, end = " ")
    print(n)

if s == l[1]:
    b = n - 1
    print(m, end =" ")
    print(b)

Solution (Python):
S, T = [str(s) for s in input().split()]
A, B = [int(i) for i in input().split()]
U = str(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)
elif T==U:
    print(A,B-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):
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):
col=list(map(str,input().split()))
num=list(map(int,input().split()))
U=str(input())
if U == col[0]:
  num[0] = num[0]-1
elif U == col[1]:
  num[1] = num[1]-1
[print(num[i],end=" ") for i in range(2)]

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):
a=list(map(str,input().split()))
b=list(map(int,input().split()))
b[a.index(input())]-=1
print(*b)

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

    if(S == U):
        result = [A - 1,B]

    if(T == U):
        result = [A,B - 1]

    print(" ".join(list(map(str,result))))

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)

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 = tuple(input().split())
A, B = tuple(map(int, input().split()))
U = input()
dic = {S : A, T : B}
dic[U] -= 1
print(str(dic[S]) + " " + str(dic[T]))

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

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

print(a, b)

Solution (Python):
s, t = 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):
st = [s for s in input().split()]
ab = [int(s) for s in input().split()]
u = input()

if u == st[0]:
  print(int(ab[0]-1),int(ab[1]))
else:
  print(int(ab[0]),int(ab[1]-1))

Solution (Python):
s, t = 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):
str = input().split()
s = str[0]
t = str[1]
a, b = map(int, input().split())
u = input()
 
if u == t :
  num = b - 1
  print(a, num)
else:
  num = a - 1
  print(num, 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 = list(input().split())
sn,st = list(map(int, input().split()))
u = input()
if s == u:
    sn -= 1
else:
    st -= 1
print(sn, st)

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 = list(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:
  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(int(a-1), int(b))
else:
  print(int(a), int(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))
elif T==U :
  print(str(A)+" "+str(B-1))

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

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

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

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

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

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

Solution (Python):
def remaining_balls_number(dict_sum_of_each_balls, remove_balls_color):
    if dict_sum_of_each_balls[remove_balls_color]:
        now_number = dict_sum_of_each_balls[remove_balls_color]
        dict_sum_of_each_balls[remove_balls_color] = now_number - 1
    return dict_sum_of_each_balls


if __name__ == '__main__':
    a_color, b_color = input().split()
    a_number, b_number = map(int, input().split())
    remove_color_ball = input()
    answer = remaining_balls_number(
        {a_color: a_number, b_color: b_number}, remove_color_ball)
    print(answer[a_color], answer[b_color])

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

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

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

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

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

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

print(a, b)

Solution (Python):
import numpy as np

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

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

U = input()

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

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

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

print(a, b)

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

d = {a: an, b:bn}
d[s] -= 1

print("{} {}".format(d[a], d[b]))

Solution (Python):
S, T = input().split(" ")
A, B = tuple(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, B)
else:
    print(A, B - 1)

Solution (Python):
import sys

INF = 1001001001

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

if __name__ == "__main__":
    resolve()

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

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

if s == S:
    A -=1
elif s == T:
    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(*[str(a)+" "+str(b)])

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

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



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

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

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


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

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

ans = a + b
if s == u:
    a -= 1
if t == u:
    b -= 1
print(str(a) + ' ' + str(b))

Solution (Python):

import numpy as np

S, T = input().split()
A, B = (int(x) for x in input().split())
U = input()

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

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

Solution (Python):
s = list(input().split())
num = list(map(int,input().split()))
target = input()

a = num[0]
b = num[1]

if s[0] == target:
  a = a-1
elif s[1] == target:
  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 u == s:
    print(str(a - 1) + ' ' + str(b))
else:
    print(str(a) + ' ' + str(b-1))

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

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

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

print(a,b)

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

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

Solution (Python):


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

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

Solution (Python):
from decimal import*
from fractions import*
import math
import functools


import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inputt = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines 

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

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

main()

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

Solution (Python):
from sys import stdin
S,T = [(x) for x in stdin.readline().rstrip().split()]
A,B = [int(x) for x in stdin.readline().rstrip().split()]
U = (stdin.readline().rstrip())
if U == S:
    A -= 1
else:
    B -= 1
print(A,B)

Solution (Python):
a,b = input().split()
ai,bi = map(int,input().split())
s = input()
if a == s: ai-=1
if b == s: bi-=1
print(ai,bi)

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

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

if __name__=="__main__":
    main()

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

Solution (Python):
input_texts = input()
text_list = input_texts.split(" ")
text_s = text_list[0]
text_t = text_list[1]

input_counts = input()
count_list = input_counts.split(" ")
count_s = int(count_list[0])
count_t = int(count_list[1])

pull_text = input()

if pull_text == text_s:
    count_s -= 1
else:
    count_t -= 1
output = str(count_s) + " " + str(count_t)
print(output)

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

Solution (Python):
import math

import numpy as np
import scipy as scp


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

dic = {s:a,t:b}

if u == s:
    dic[s] -= 1
else:
    dic[t] -= 1

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

Solution (Python):
s, t = input().split()
u, v = map(int, input().split())
a = input()
d = {}
d[s] = u
d[t] = v
d[a] -= 1
print(d[s], d[t])

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

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




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

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

Solution (Python):
input_str = list(map(str, input().split()))
input_num = list(map(int, input().split()))
input_out = str(input())

if input_out == input_str[0]:
    input_num[0] -= 1
elif input_out == input_str[1]:
    input_num[1] -= 1

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

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

if u == str[0]: n[0] -= 1
else: n[1] -= 1

print("{} {}".format(n[0], n[1]))

Solution (Python):
s,t = input().split()
sn,tn = map(int,input().split())
u  = input()

if s == u:
    print(str(sn-1) + ' '+ str(tn))
else:
    print(str(sn) + ' ' + str(tn-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=list(map(int,input().split()))
if S==input():
    A-=1
else:
    B-=1
print(A,B)

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

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

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

print(a,b)

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s, t = list(map(str, readline().rstrip().decode('utf-8').split()))
    a, b = list(map(int, readline().split()))
    u = str(readline().rstrip().decode('utf-8'))
    if s == u:
        print(a - 1, b)
    else:
        print(a, b - 1)


if __name__ == '__main__':
    solve()

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s,t=STRM()
    a,b=INTM()
    u=STR()
    if s==u:
        print(a-1,b)
    else:
        print(a,b-1)
if __name__ == '__main__':
    do()

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

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)

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

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

    if S == U:
        A -= 1
    else:
        B -= 1
 
    print(str(A) + " " + str(B))
 
if __name__ == "__main__":
    resolve()

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):
ball_list = input().split()
ball_num = list(map(int, input().split()))
text = input()

if text == ball_list[0]:
    ball_num[0] -= 1
else:
    ball_num[1] -= 1

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

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

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

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

Solution (Python):
s,t=[x for x in input().split()]
a,b=[int(y) for y 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:
  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()

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

Solution (Python):
Moji = input().split()
Ball = input().split()
Takahasi = input()

if Moji[0] == Takahasi:
  print(int(Ball[0])-1,int(Ball[1]))
else:
  print(int(Ball[0]),int(Ball[1])-1)

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

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

Solution (Python):
s, t = list(input().split())
a, b = map(int, input().split())
u = input()
dic = {s: a, t: b}
dic[u] = dic[u]-1
print(dic[s], dic[t])

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

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

Solution (Python):
s,t = (str(i) for i in 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):
a,s=input().split()
m,n=map(int,input().split())
x=input()
print(m-(a==x),n-(s==x))

Solution (Python):
dic_lst=[]
lst_a=input().split()
lst_b=list(map(int,input().split()))
wd=input()
for i in range(2):
    dic_lst.append([lst_a[i],lst_b[i]])
    if dic_lst[i][0]==wd:
        dic_lst[i][1]-=1
ans=[]
for i in range(2):
    ans.append(str(dic_lst[i][1]))
print(" ".join(ans))

Solution (Python):

strA, strB = input().split()
Aballs, Bballs = map(int, input().split())
u = input()


if u == strA:
    print(str(int(Aballs - 1)) + " " + str(Bballs))
else:
    print(str(Aballs) + " " + str(int(Bballs - 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):
wrd = input().split()
AB = input().split()
U = input()

num = list(map(int, AB))

if wrd[0]==U:
    num[0] -=1
else:
    num[1] -=1

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

Solution (Python):

s,t = list(map(str,input().split()))
a,b = list(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 = [i for i in 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 = 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 = input().split()
c = [int(i) for i in input().split()]
g = input()

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

h = [str(i) for i in c]
print(' '.join(h))

Solution (Python):
S,T = input().split()
cnt = [int(i) for i in input().split()]
U = input()
 
if U == S:
  cnt[0] -= 1
else:
  cnt[1] -= 1

print(" ".join([str(j) for j in cnt]))

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)