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

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

print(a,b)

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

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

print(A, B)

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

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

Solution (Python):
a = input().split()
b = list(map(int,input().split()))
c = input()

if a[0] == c:
  b[0] = b[0]-1
else:
  b[1] = b[1]-1
  
print(b[0],end = " "),print(b[1])

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

Solution (Python):
def ball(s , t , a , b , u):

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

    return str(a) + " " + str(b)

def main():
    s , t = map(str , input().split())
    a , b = map(int , input().split())
    u = str(input())
    print(ball(s , t , a , b , u))

if __name__ == '__main__':
    main()

Solution (Python):
s1, s2 = input().split()
a, b = map(int, input().split())
s3 = input()

if s3==s1:
  a-=1
else:
  b-=1
print("%d %d" % (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)
else:
    print(A,B)

Solution (Python):
import sys

words = input().split()
word_cnts = list(map(int, input().split()))

word_map = dict()
for word, word_cnt in zip(words, word_cnts):
    word_map[word] = word_cnt

bad_word = input()
word_map[bad_word] -= 1

for idx, word in enumerate(words):
    sys.stdout.write(str(word_map[word]))
    if idx == len(words)-1:
        sys.stdout.write('\n')
    else:
        sys.stdout.write(' ')

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

if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

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

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

if U == S:
  A -= 1
elif U == T:
  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
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 = 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()
flag=1
if u==s:
  print(a-1,b)
  flag=0
if u==t:
  print(a,b-1)
  flag=0
if flag==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:
    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:
    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):
def resolve():
    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)

resolve()

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

Solution (Python):
a,b=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=str(input())
if(S==U):
    A-=1
else:
    B-=1
print("{0} {1}".format(A,B))

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

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

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

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

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

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

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

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

Solution (Python):


import sys
import math
import time

import collections
from collections import deque
import queue
import copy


def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z


def bfs(SS, x, y, H, W):
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" 
    for i in range(4): 
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      
      
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" 
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      
  return mlength


def prime_factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n //= 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
    a.append(n)
  return a







ST = str(input()).split()
AB = str(input()).split()
A = int(AB[0])
B = int(AB[1])
U = str(input())

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

Solution (Python):
''' Hey stalker :) '''
INF = 10**10
def main():
    
    ''' Cook your dish here! '''

    s, t = input().split()
    a, b = get_list()
    dic = {}
    dic[s] = a
    dic[t] = b
    dic[input()] -= 1
    print(dic[s], dic[t])



''' Pythonista fLite 1.1 '''
import sys
from collections import defaultdict, Counter
from bisect import bisect_left, bisect_right

import math

out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()

print(*out, sep='\n')

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

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

print(s,t)

Solution (Python):
Input = list(map(str,input().split()))
S = Input[0]
T = Input[1]

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

U = str(input())

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

print(A,B)

Solution (Python):
x,y=input().split()
a,b=map(int,input().split())
z=input()
a=a-(x==z)
b=b-(y==z)
print(a,b)

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=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):
name = input().split()
num = list(map(int,input().split()))
choice = input()

if choice == name[0]:
    print(num[0]-1, num[1])
else:
    print(num[0], num[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):
def resolve():
    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)

resolve()

Solution (Python):
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()

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


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

if(one == third):
  print(a-1, b)
  
else:
  print(a, b-1)

Solution (Python):
def resolve():
    st= input().split()
    ab= list(map(int, input().split()))
    u=input()
    ab[st.index(u)] -=1
    print(*ab)

if __name__ == "__main__":
    resolve()

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

Solution (Python):
strings = input().split(' ')
remains = input().split(' ')
dec = input()

sRem = int(remains[0])
tRem = int(remains[1])

if dec == strings[0]:
  sRem -= 1
else :
  tRem -= 1

print("{} {}".format(sRem, tRem))

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

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

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

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

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

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

Solution (Python):




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


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

Solution (Python):
S, T = [s for s in input().split()]
A, B = [int(s) for s 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:
    a -= 1
elif u == t:
    b -= 1
print("{} {}".format(a, b))

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

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

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

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

if c == s:
  print("%d %d" %(a-1, b))
elif c == t:
  print("%d %d" %(a, b-1))

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

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

Solution (Python):
s=input().split()
li = list(map(int,input().split()))
s1=input()
if s1 == s[0]:
    print(str(li[0]-1) + " "+str(li[1]))
else:
    print(str(li[0])+" "+str(li[1]-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()

balls = {S:A, T:B}
balls[U] -= 1

print("%d %d"%(balls[S], balls[T]))

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
ans = str(a)+" "+str(b)
print(ans)

Solution (Python):

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

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


print (a,b)

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

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

Solution (Python):
color = input().split(" ")
nums = list(map(lambda x: int(x), input().split(" ")))
U =input()
index = color.index(U)
nums[index] -= 1

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

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

print(A, B)

Solution (Python):

"""
Created on Sun Feb  9 20:50:13 2020

@author: H_Hoshigi
"""

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

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

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

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

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S, T = sr().split()
A, B = lr()
U = sr()
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
if(U==T):
  B-=1
print(str(A)+" "+str(B))

Solution (Python):
A, B = input().split()
a, b = map(int, input().split())
C = input()

if C == A:
    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(" ")

d = {}
a, b = map(int, input().split(" "))
d[s] = a
d[t] = b

u = input()
d[u] -= 1
out = "%d %d" % (d[s], d[t])
print(out)

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()
color={}
color[s],color[t]=map(int,input().split())

r=input()

color[r]=color[r]-1

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

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

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

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

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



def solve(*args: str) -> str:
    s, t = args[0].split()
    a, b = map(int, args[1].split())
    u = args[2]

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

    return '{} {}'.format(a, b)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

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

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

if s[0]==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 = input().split()
A, B = map(int, input().split())
U = input()

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

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

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

print(a, b)

Solution (Python):
import math
import itertools
n, d = list(input().split())
A, B = list(map(int, input().split()))
u = input()

if n==u:
    print(A-1, B)
elif d==u:
    print(A, B-1)

Solution (Python):
from bisect import *
from collections import *
from fractions import gcd


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

S, T = LIST()
A, B = MAP()
U = input()

if U == S:
    A = A - 1
elif U == T:
    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(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}".format(a=a,b=b))

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

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

A()

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

if x==A:
    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:
    A -= 1
if T==U:
    B -=1
print("{} {}".format(A, B))

Solution (Python):

import sys
import math
import numpy as np
import itertools




s, t = 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 = [item for item in input().split()]
A, B = [int(item) for item in input().split()]
U = input()

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

Solution (Python):

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

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

print(A, B)

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

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

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

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

print(a,b)

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

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

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

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

Solution (Python):
from bisect import bisect_right, bisect_left
from collections import Counter, deque
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import groupby, permutations, combinations, product
from sys import stdin, stderr





def gcd(x, y):
    return x if y == 0 else gcd(y, x % y)





def exgcd(x, y):
    if y == 0:
        return 1, 0
    a, b = exgcd(y, x % y)
    return b, a - (x // y) * b



def lcm(x, y):
    m = gcd(x, y)
    return (x // m) * (y // m)


def main():
    s, t = input().split()
    a, b = [int(x) for x in input().split()]
    u = input()
    if u == s:
        a -= 1
    else:
        b -= 1
    return " ".join([str(x) for x in [a, b]])


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

Solution (Python):
S, T = input().split()
s, t = [int(x) for x in input().split()]
U = input()
print(s-(U==S), t-(U==T))

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

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

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""




s,t = input().split()

a,b = m()

p = input()[:-1]

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

Solution (Python):
a, b = map(str, input().split())
a_num, b_num = map(int, input().split())
strings = input()

if strings == a:
    print(a_num -1, b_num)
elif strings == b:
    print(a_num, b_num -1)

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    s, t = LS()
    a, b = LI()
    u = S()
    if u == t:
        print(" ".join([str(a), str(b-1)]))
    else:
        print(" ".join([str(a-1), str(b)]))

if __name__ == '__main__':
    main()

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