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

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

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

Solution (Python):
l = {}
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):
import fileinput

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

if __name__ == '__main__':

    ABC_154_A()

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

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

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

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

for i in range(3):
    val = input().split()
    array.append(val)

A,B = [int(s) for s in array[1]]

if array[2][0] == array[0][0]:
    print(str(A - 1) + " " + str(B))
else:
    print(str(A) + " " + str(B - 1))

Solution (Python):
import itertools
import math
import fractions
import functools
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(i) for i in input().split())
U = input()


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

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

s = x[0]
t = x[1]

y = input().split()

a = int(y[0])
b = int(y[1])

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

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

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

Solution (Python):
s1, s2 = input().split()
n1, n2 = map(int, input().split())
u = input()
if u == s1:
  n1 -= 1
else:
  n2 -= 1
print(n1, n2)

Solution (Python):

"""
Created on Fri May  8 14:17:18 2020

@author: shinba
"""
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, H = map(int, input().split())

counter = {
    S: A,
    T: H
}

U = input()

counter[U] -= 1

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

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

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

print(str(countdict[s]) + " " + str(countdict[t]))

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

query = input()
if query == s:
    a -= 1
else:
    b -= 1
print(str(a) + " " + str(b))

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


if __name__ == '__main__':
    solve()

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):
from sys import stdin, setrecursionlimit


def main():
    s, t = map(str, stdin.readline().split())
    a, b = map(int, stdin.readline().split())
    u = stdin.readline()[:-1]

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

    print(a, b)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Solution (Python):
s,t = map(str,input().split())

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

u = input()

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

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

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

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

Solution (Python):
String = list(input().split())
Number = list(map(int,input().split()))
U = input()

if U == String[0]:
    num = Number[0]-1
    print(num,Number[1])
elif U == String[1]:
    num = Number[1] - 1
    print(Number[0], num)
else:
    print("Error")

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 = list(map(int,input().strip().split()))
print(*((a-1,b) if input() == s else (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()
li = list(map(int,input().split()))
if S==input():
 li[0]-=1
else:
 li[1]-=1
print(*li)

Solution (Python):
S, T  = input().split()
SN, TN  = input().split()
C = input()
m = {}
m[S] = int(SN)
m[T] = int(TN)
m[C] -= 1
print(str(m[S]) + ' ' + str(m[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(str(A-1)+" "+str(B))
else:
  print(str(A)+" "+str(B-1))

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

if U == S:
    A -= 1
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 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())
print(*((A - 1, B) if S == U else (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
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)
elif T == U:
    print(A,B-1)
else:
    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))
elif u == t:
    print("{} {}".format(a, b-1))

Solution (Python):


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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  
def Is(): return map(int, input().split())  
def LI(): return list(map(int, input().split()))  
def TI(): return tuple(map(int, input().split()))  
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  
def LS(): return list(input())  
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

s, t = Ss()
a, b = Is()
u = S()

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
s,t = [i.rstrip() for i in readline().split()]
a,b = [int(i) for i in readline().split()]
u = readline().rstrip()

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()
ans = [A, B]
if U == S:
    ans[0] = A - 1
else:
    ans[1] = B - 1
print(" ".join(map(str, ans)))

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

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

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

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

print(a, b)

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

Solution (Python):
S, T = [_ for _ in input().split()]
A, B = [int(_) for _ in 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 :
    print('%d %d' % ((a - 1), b))
else :
    print('%d %d' % (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(a,b)

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

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

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

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

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

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

Solution (Python):

x, y = input().split()
a, b = map(int,input().split())
z = input()
if (z == x):
    a -= 1 
elif(z == y):
    b -= 1
else:
    pass
print(str(a) + " " + str(b))

Solution (Python):

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

def main(x1, x2, y1, y2, z):
    if (z == x1):
        y1 = int(y1) - 1 
    elif(z == x2):
        y2 = int(y2) - 1
    else:
        pass
    print(str(y1) + " " + str(y2))

main(S, T, A, B, U)

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

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

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

Solution (Python):
def solve():
    s, t = input().split()
    a, b = map(int, input().split())
    mp = {s:a, t:b}
    u = input()
    mp[u] -= 1
    return mp[s], mp[t]

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

Solution (Python):
S,T = map(str,input().split())
X,Y = map(int,input().split())
Z = input()
if S==Z:
  print(X-1,Y)
elif T==Z:
    print(X,Y-1)
else:
    print(X,Y)

Solution (Python):
S, T = map(str, 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()
tm = {}
a,b=map(int,input().split())
tm[s]=a
tm[t]=b
tm[input()]-=1
print(tm[s],tm[t])

Solution (Python):



"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""


"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""

li = input().split()

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

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

if n==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=[]
if u==s:
  ans.append(str(a-1))
  ans.append(str(b))
else:
  ans.append(str(a))
  ans.append(str(b-1))
print(" ".join(ans))

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 -= 1
else:
    b -= 1

print(a, b)

Solution (Python):
s, t, a, b, u = open(0).read().split()
a, b = int(a), int(b)
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=(int(x) for x in input().split())
u=input()


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

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

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

Solution (Python):
s=input().split()
b = {}
a = list(map(int, input().split()))

for i in range(2):
  b[s[i]] = a[i]
  
b[input()] -=1

print(str(b[s[0]])+" "+str(b[s[1]]))

Solution (Python):
il1 = input().split()
il2 = [int(k) for k in input().split()]
S = il1[0]
T = il1[1]
A = il2[0]
B = il2[1]
U = input()
if (S.find(U) >= 0):
    A = A-1
if (T.find(U) >= 0):
    B = B-1
print(str(A) + " " + str(B))

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

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

print(A, B)

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

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

Solution (Python):


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


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

Solution (Python):

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

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

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

Solution (Python):
s,t=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):
s1 ,s2 = input().split()
n1,n2 = map(int,input().split())
st = input()

if st == s1:
    n1-=1
else:
    n2 -=1

print(n1,n2)

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):
c=input().split()
n=[int(i) for i in input().split()]
d=dict(zip(c,n))
d[input()]-=1
print(d[c[0]],d[c[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):
str_list = input().split()
num_list =  [int(i) for i in input().split()]
del_boll = input()

boll_dic = {str_list[0]:num_list[0],str_list[1]:num_list[1]}
boll_dic[del_boll] -= 1

print(boll_dic[str_list[0]],boll_dic[str_list[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:
    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)
elif U==T:
    print(A,B-1)
else:
    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=[x for x in input().rstrip().split()]
A,B=[int(x) for x in input().rstrip().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 = A-1
elif U == T:
    B = B-1

print(A, B)

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

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

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

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

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

d={}
d[S]=A
d[T]=B

if U==S:
    d[S]-=1
else:
    d[T]-=1

print(d[S],d[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:
    a-=1
else:
    b-=1

print(a,b)

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

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

Solution (Python):

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

Solution (Python):

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

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

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

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

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

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

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

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('{} {}'.format(A, B))

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

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

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

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

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

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

print(a, b)

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

res = []
for i, j in zip(S,A):
    if i == U:
        j-= 1

    res.append(j)
print(*res)

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

if u in 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)
    exit()
if T == U:
    print(A, B-1)
    exit()

Solution (Python):
import sys
s, t = map(str, sys.stdin.readline().split())
a, b = map(int, sys.stdin.readline().split())
u = sys.stdin.readline().rstrip()
if s == u:
  print(a-1, b)
else:
  print(a, b-1)

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

Solution (Python):
s,t=input().split()
a,b=map(int,input().split())
if input()==s:
    x=[a-1,b]
else:
    x=[a,b-1]
y = [str(n) for n in x]
print(' '.join(y))

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

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

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

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

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

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

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

Solution (Python):
x = input().split()
y = input().split()
z = input().split()

a = int(y[0])
b = int(y[1])

if x[0] == z[0]:
  a -= 1
elif x[1] == z[0]:
  b -= 1
  
print(str(a)+" "+str(b))

Solution (Python):
former ,latter = map(str,input().split())
former_number  , latter_number = map(int,input().split())
check = input()
if check == former:
    print(former_number-1,latter_number) 
else:
    print(former_number,latter_number-1)

Solution (Python):
ST = input().split()
AB = [int(x) for x in input().split()]
U = input()

if U == ST[0]:
    AB[0] = AB[0]-1
else:
    AB[1] = AB[1]-1
print(AB[0], AB[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 = 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 u == s:

    a=a-1

else :

    b=b-1

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

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

Solution (Python):

















import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    s,t = map(str,input().split())
    a,b = readInts()
    m = input()
    if m == s:
        print(a-1,b)
    else:
        print(a,b-1)
if __name__ == '__main__':
  main()

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

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

print(A, B)

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

Solution (Python):
x = input().split()
y = input().split()
z = input()
if x[0] == z:
  y[0] = int(y[0]) - 1
elif x[1] == z:
  y[1] = int(y[1]) - 1
print(str(y[0])+' '+str(y[1]))

Solution (Python):
red,blue=input().split()
red_num,blue_num=map(int,input().split())
throw=input()
if red==throw:
  red_num-=1
else:
  blue_num-=1
print(red_num,blue_num)