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

Solution (Python):
color = input().split()
a, b = map(int, input().split()) 
target_color = input()

if color[0] == target_color:
  a -= 1
if color[1] == target_color:
  b -= 1

print(a,b)

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

if s==u:
  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())
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()
count_S = U.count(S)
count_T = U.count(T)


S_amount = A - count_S
U_amount = B - count_T

print(S_amount,U_amount)

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

d = {s: a, t: b}
d[u] -= 1

print d[s], d[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 u == s:
    a -= 1

else:
    b -= 1

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

Solution (Python):
st = input().split()
ab = input().split()
U = input()
S, T = st[0], st[1]
A, B = [int(num) for num in ab]
if U == S:
  A -= 1
elif U == T:
  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=A-1
elif T==U:
    B=B-1
print(A,B)

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

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

if (c == a):
  aa = aa - 1
else:
  bb = bb - 1
print(aa,bb)

Solution (Python):

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


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

Solution (Python):
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()
if s == u:
    a -= 1
elif t == u:
    b -= 1
print(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("{} {}".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 = 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):
Ball = list(map(str, input().split()))
Num = list(map(int, input().split()))
OutputBall = input()
Output = [Num[i] - 1 if Ball[i] == OutputBall else Num[i] for i in range(2)]
print(Output[0], Output[1])

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

Solution (Python):
import sys
input = sys.stdin.readline
S, T = input().split()
A, B = map(int, input().split())
U = input().split('\n')[0]
if U == S:
    print("{} {}".format(A-1, B))
else:
    print("{} {}".format(A, B-1))

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

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

print(A-1,B) if(S==U) 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, end=" ")
print(B)

Solution (Python):
words = input().split()
cards  = [int(x) for x in input().split()]
drop   = input()

if drop == words[0]:
    cards[0] -= 1
    print(str(cards[0]) + " " + str(cards[1]))
elif drop == words[1]:
    cards[1] -= 1
    print(str(cards[0]) + " " + str(cards[1]))

Solution (Python):

import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    if U==S:
        print(' '.join(map(str, [A-1, B])))
    else:
        print(' '.join(map(str, [A, B-1])))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    T = next(tokens)  
    A = int(next(tokens))  
    B = int(next(tokens))  
    U = next(tokens)  
    solve(S, T, A, B, U)

if __name__ == '__main__':
    main()

Solution (Python):
temp = input().split()
s = temp[0]
t = temp[1]
num = list(map(int, input().split()))
u = input()

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

print(num[0], num[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)
elif U == T:
    print(A,B-1)
else:
    print(A,B)

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

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

b[a.index(c)] -= 1

for i in range(len(b)):
	print(b[i],end=' ')

Solution (Python):
moji = input().split()
ball = list(map(int, input().split()))

ball[moji.index(input())] -= 1

print(*ball)

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

s_dic = {}
t_dic = {}

s_dic[s] = a
t_dic[t] = b

if u in s_dic:
    s_dic[s] -= 1
elif u in t_dic:
    t_dic[t] -= 1

ans = str(s_dic[s]) + ' ' + str(t_dic[t])

print(ans)

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

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 = (str(x) for x in input().split(' '))
A, B = (int(x) for x in input().split(' '))
U = input()

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

Solution (Python):


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

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

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

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

print(str(A) + " " + str(B))

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

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

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

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

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

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

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

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

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

Solution (Python):
S,T=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 U==S:
    A=A-1
else:
    B=B-1
print(" ".join([str(A),str(B)]))

Solution (Python):
s_lis = input().split()
n_lis = list(map(int, input().split()))
s = input()
if s_lis[0] == s:
    n_lis[0] -= 1
else:
    n_lis[1] -= 1
print(*n_lis)

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

Solution (Python):
n , m = map(str , input() . split())
n1 , m1 = map(int , input() . split())
s = input()
if s == n :
    print(n1 - 1 , m1)
elif s == m:
    print(n1 , m1 - 1)

Solution (Python):
def remain(S, T, A, B, U):
  if U == S:
    A -= 1
  elif U == T:
    B -= 1
  return (A, B)

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

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

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

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

if(S[0]==U):
    a[0]=a[0]-1
if(S[1]==U):
    a[1]=a[1]-1
print(a[0]," ",a[1])

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

d = {s:a, t:b}
d[u] -= 1

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

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

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

Solution (Python):
S,T=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 = list(map(str, 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 numpy
s, t = input().split()
ab = numpy.array(list(map(int,input().split())))
u = input()

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

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

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

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

Solution (Python):
(red, blue) = list(input().split())
(p, q) = list(map(int, input().split()))
st = input()

if red == st:
  print( str(p-1)+ " " +str(q) )
else:
  print( str(p)+ " " +str(q-1) )

Solution (Python):
color = input().split()
number = list(map(int,input().split()))
choice = str(input())
 
for i in [0,1]:
  if choice == color[i]:
    number[i] -= 1
    
print(number[0],number[1])

Solution (Python):

"""
Created on Mon Feb 17 10:26:25 2020

@author: 17664
"""

balls = {}
s, t = input().split()
balls[s], balls[t] = [int(num) for num in input().split()]
balls[input()] -= 1

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

Solution (Python):
from sys import stdin


def get_result(data):
    S, T = data[0]
    A, B = data[1]
    U = data[2][0]
    if S == U:
        A = A - 1
    elif T == U:
        B = B - 1
    return ' '.join([str(A), str(B)])

if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(str, val.split(' '))) for val in raw_data]
    data[1] = [int(val) for val in data[1]]
    result = get_result(data)
    print(result)

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

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()))
    if s == str(readline().rstrip().decode('utf-8')):
        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()
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):

import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    if S == U:
        A -= 1
    if T == U:
        B -= 1
    print(A, B)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    T = next(tokens)  
    A = int(next(tokens))  
    B = int(next(tokens))  
    U = next(tokens)  
    solve(S, T, A, B, U)

if __name__ == '__main__':
    main()

Solution (Python):
def main():

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

if __name__ == '__main__':
    print(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 = 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 = list(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 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 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
else: B -= 1
print(A, B)

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

data = {
    str(S): A,
    str(T): B,
}

data[str(U)] -= 1

s = data[str(S)]
t = data[str(T)]
print('{} {}'.format(s, t))

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



from math import *
from copy import *
from string import *				
from random import *				
from sys import stdin
from sys import maxsize
from operator import *				
from itertools import *
from collections import Counter		
from collections import defaultdict 

'''

'''

def solve(l):
	n = len(l)
	

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

Solution (Python):
ball = input().split()
number = list(map(int, input().split()))
U = input()

if U == ball[0]:
    number[0] -= 1
else:
    number[1] -= 1
print(number[0], number[1])

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

Solution (Python):
sp=input().split()
A,B=list(map(int,input().split()))
s=input()
if sp[0]==s:print(A-1,B)
elif sp[1]==s:print(A,B-1)

Solution (Python):
a, b = map(str, input().split(" "))
c, d = map(int, input().split(" "))
e = 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 = 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:
	print(a -1,end=' ')
	print(b)
elif u == t:
	print(a, end=' ')
	print(b -1)

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

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    a,b = LS()
    c = LI()
    d = S()
    if d == a:
        c[0] -= 1
    elif d == b:
        c[1] -= 1

    return JA(c, " ")


print(main())

Solution (Python):
ar = input().split(" ")
br = list(map(int,input().split(" ")))
c = input()
if c == ar[0]:
    br[0] -= 1
else:
    br[1] -= 1
print(br[0],br[1])

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())
n,m=map(int,input().split())
ss=input()
if s==ss:
  print(n-1,m)
else:
  print(n,m-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):
def main():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    if S == U:
        A -= 1
    else:
        B -= 1
    print(A, B)
    return


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

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

Solution (Python):
s = raw_input().split()
a, b = map(int, raw_input().split())
x = raw_input().strip()
if x == s[0]:
    a -= 1
else:
    b -= 1
print str(a) + ' ' + str(b)

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

c = {}
c[S] = A
c[T] = B
c[U] -= 1
print("{} {}".format(c[S],c[T]))

Solution (Python):
S, T = input().split()
A, B = input().split()
U = input()
num = {}
num[S] = int(A)
num[T] = int(B)
num[U] = num[U] - 1
print(str(num[S])+" "+str(num[T]))

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

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

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

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

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

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

print(str(A)+" "+str(B))

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

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

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

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

print(a,b)

Solution (Python):
input = [input().split(" ") for i in range(3)]
c = {}
c[input[0][0]] = int(input[1][0]) 
c[input[0][1]] = int(input[1][1])
c[input[2][0]] -= 1
print(c[input[0][0]], c[input[0][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)

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

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

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):
list1 = input()
list2 = input()
list3 = input()
nlist1 = list1.split(' ')
nlist2 = list2.split(' ')
S = nlist1[0]
T = nlist1[1]
lenS = int(nlist2[0])
lenT = int(nlist2[1])
select = list3
if select == S:
    lenS -= 1
elif select == T:
    lenT -= 1
print(lenS,lenT)

Solution (Python):





s, t = input().split()
a, b = [int(v) for v in input().split()]
u = input()

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

print("%d %d" % (a, b))

Solution (Python):
sa, sb  = input().split()
a,  b   = map(int, input().split())
sc      = input().strip()
if sc == sa:
    print(a-1, b, sep = ' ')
else:
    print(a, b-1, sep = ' ')

Solution (Python):
s1,s2 = (input().split(" "))
a1,a2 = list(map(int,input().split(" ")))
U =input()
if U == s1:
    a1 -= 1
else:
    a2-=1
print(a1,a2)

Solution (Python):
def getline():
    input_line = input()
    input_list = input_line.split()
    return input_list

temp = getline()
S = temp[0]
T = temp[1]

temp = getline()
A = int(temp[0])
B = int(temp[1])

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

Solution (Python):
input1 = list(map(str,input().split()))
input2 = list(map(int,input().split()))
input3 = input()

if input1.index(input3) == 0:
    print(input2[0] - 1, input2[1])
    
elif input1.index(input3) == 1:
    print(input2[0], input2[1] - 1)
    
else:
    print(input2[0],input2[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):
input1 = input()
input2 = input()
input3 = input()

input1a = input1.split(" ")
input2a = input2.split(" ")

s = input1a[0]
t = input1a[1]
a = input2a[0]
b = input2a[1]

if input3 == s:
    a = int(a) - 1
else:
    b = int(b) - 1

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

Solution (Python):
line1 = input()
line2 = input()
line3 = input()

str_s, str_t = line1.split(" ")
num_a, num_b = line2.split(" ")

if line3 == str_s:
    print(str(int(num_a)-1), num_b)
else:
    print(num_a,str(int(num_b)-1))

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

print(A,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
else:
  pass
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()
d={}
d[a]=0
d[b]=0
d[a],d[b]=map(int,input().split())
x=input()
d[x]-=1
print(d[a],d[b])

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

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

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

balls = {}

balls[s] = a
balls[t] = b

balls[u] = balls[u] - 1

print('{0} {1}'.format(balls[s], balls[t]))

Solution (Python):
b1,b2=map(str,input().split())
c1,c2=map(int,input().split())
x=input()
if x==b1:
	print(c1-1,c2)
elif x==b2:
	print(c1,c2-1)
else:
	print(c1,c2)

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):
l=input().split() 
n = list(map(int, input().split()))
t=input()
if l[0]==t:
    n[0]=n[0]-1
    print(n[0],n[1])
elif l[1]==t:
    n[1]=n[1]-1
    print(n[0],n[1])

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

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

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

Solution (Python):
def main():
    s,t = input().split()
    a,b = map(int,input().split())
    U = input()
    res = {
        s:a,
        t:b
    }
    res[U] -=1
    print("{0} {1}".format(res[s], res[t]))


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)
if t == u:
    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 = list(map(int, input().split()))
u = input()

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

Solution (Python):

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

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

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

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

print(a,b)

Solution (Python):
moji_arr = input()

first = moji_arr.split()[0]
second = moji_arr.split()[1]

num = input()
num_arr = list(map(int, num.split()))

u = input()

if u==first:
    num_arr[0] = num_arr[0] - 1
elif u==second:
    num_arr[1] = num_arr[1] - 1

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

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

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

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

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

print(A, B)

Solution (Python):
colors = list(map(str, input().split()))
numbers = list(map(int, input().split()))
target_color = input() 

for index, color in enumerate(colors):
  if color == target_color:
    numbers[index] = numbers[index] - 1
    
 
for num in numbers:
  print(str(num) + " ", end="")

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(str(A)+' '+str(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):
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()
ss,tt=list(map(int,input().split()))

st=input()

if st == s:
  ss-=1
else:
  tt-=1
print(ss,tt)

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):
name = input().split()
n1 = name[0]; n2 = name[1]
lnum = input().split()
lnum1 = int(lnum[0]); lnum2 = int(lnum[1])
l1 = [n1, lnum1]
l2 = [n2, lnum2]
choosen = input()
if choosen == n1:
    print(l1[1]-1, end=" ")
    print(l2[1])
if choosen == n2:
    print(l1[1], end=" ")
    print(l2[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)