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=a-1
if u==t:
    b=b-1
print(str(a)+' '+str(b))

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

print(C, D)

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

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

Solution (Python):
import sys

def main():
    k = input().replace('\n','').split()
    a = input().replace('\n','').split()
    u = input().replace('\n','')
    a[k.index(u)]=int(a[k.index(u)]) - 1
    print(str(a[0]) + ' ' + str(a[1]))
if __name__ == '__main__':
    input = sys.stdin.readline
    main()

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

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

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

import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    numA = A
    numB = B
    if U == S:
        numA -= 1
    else:  
        numB -= 1

    print(numA, numB)
    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):



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

string = input()
dic[string] -= 1
print(dic[s], dic[t])

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)

Solution (Python):
input1 = input().split()
input2 = input().split()
input3 = input()

if input3 == input1[0]:
    input2[0] =  int(input2[0]) - 1
else:
    input2[1] =  int(input2[1]) - 1

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

Solution (Python):
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
(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()
A_B=input()
U=input()
list_S_T=[]
for i in range(len(S_T)):
    if S_T[i]==" ":
        S =S_T[0:i]
        T=S_T[i+1:len(S_T)]
for i in range(len(A_B)):
    if A_B[i]==" ":
        A = int(A_B[0:i])
        B = int(A_B[i+1:len(A_B)])
if S==U:
    A = A-1
elif T==U:
    B = B-1
print(A,B)

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

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

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

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

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

print(A, B)

Solution (Python):


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

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

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

ns,nt=map(int,input().split())

judge = input()

if s == judge:
    ns = ns-1
elif t == judge:
    nt = nt -1
print(ns,nt)

Solution (Python):
balls_color1, balls_color2 = input().split()
balls_count1, balls_count2 = map(int, input().split())

balls = {
    balls_color1: balls_count1,
    balls_color2: balls_count2
}

trash = input()
balls[trash] -= 1

print(balls[balls_color1], balls[balls_color2])

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):
L = input().split()
S = L[0]
T = L[1]
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 u == s:
    a -= 1
elif u == t:
    b -= 1

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

Solution (Python):
def main():
  value1 = input().split()[0]
  count_list = input().split()

  if value1 == input():
    count_list[0] = str(int(count_list[0]) - 1)
  else:
    count_list[1] = str(int(count_list[1]) - 1)

  print(count_list[0] + ' ' + count_list[1])

main()

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

Solution (Python):
s,t = input().split(' ')
cs, ct = map(int,input().split(' '))
th = input()

if th == s:
    cs -= 1
else:
    ct -= 1
print(cs, ' ', ct)

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):
a = []
a = input().split()
S = a[0]
T = a[1]
b = []
b = input().split()
A = int(b[0])
B = int(b[1])
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:
  a-=1
elif u == t:
  b-=1
print(a,b)

Solution (Python):
S, T = input().split()
a, b = input().split()
U = input()

a = int(a)
b = int(b)

if S==U:
  a-=1
if T==U:
  b-=1

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

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

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


if(a == c):
    print(q-1,w)
else:
    print(q,w-1)

Solution (Python):
flag = input().split()
S = flag[0]
T = flag[1]

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

print(A,B)

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 T==U else B))

Solution (Python):
strs = input().split()
nums = list(map(int, input().split()))
U = input()




if U == strs[0]:
    print(nums[0]-1, nums[1])
elif U == strs[1]:
    print(nums[0], nums[1]-1)
else:
    pass

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

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

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

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

print(A, B)

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

Solution (Python):
Color = input().split()
ColNum = list(map(int,input().split()))
Ball=input()

if(Ball == Color[0]):
  ColNum[0] -= 1
elif(Ball == Color[1]):
  ColNum[1] -= 1
else:
  print('error!')

print(str(ColNum[0]) + ' ' + str(ColNum[1]))

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

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

U=input()
if U==n[0]:
    m[0]-=1
else:
    m[1]-=1
print(str(m[0])+" "+str(m[1]))

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

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

print(A,B)

Solution (Python):
S,T=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 =  [str(x) for x in input().split()]

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

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

Solution (Python):
input1 = input().split(" ")
input2 = input().split(" ")
input3 = input()
if input1[0] == input3 :
	print(str(int(input2[0])-1)+" "+input2[1])
elif input1[1] == input3:
    print(input2[0]+" "+str(int(input2[1])-1))

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

A , B =  [int(x) for x in 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:
    a-=1
else:
    b-=1
print(a,b)

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

a = A[0]
b = A[1]

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

print(a,b)

Solution (Python):
a = input().split()
b = [int(s) for s in input().split()]
c = input()

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

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

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

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

dic = {S:A,T:B}

if S == U:
    dic[S] = dic[S] - 1
    print(dic[S])
    print(dic[T])
elif T == U:
    dic[T] = dic[T] - 1
    print(dic[S])
    print(dic[T])

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

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

print(A,B)

Solution (Python):
import sys


TEST_INPUT = [
    """
    red blue
    3 4
    red
    """,
    """
    red blue
    5 5
    blue
    """
]
ANSWER = [
    "2 4",
    "5 4"
]


class InputHandler:

    def __init__(self, text_lines="", is_test=False):
        self.data = list(text_lines.split("\n"))
        self.index = 0
        self.is_test = is_test

    def input(self):
        if self.is_test:
            self.index += 1
            return self.data[self.index].strip()
        else:
            return sys.stdin.readline().rstrip()


def solve(s, t, a, b, u):
    if s == u:
        return str(a - 1) + " " + str(b)
    else:
        return str(a) + " " + str(b - 1)


def input_and_solve(ih):
    s, t = ih.input().split()
    a, b = map(int, ih.input().split())
    u = ih.input()
    res = solve(s, t, a, b, u)
    return res


def main():
    ih = InputHandler()
    res = input_and_solve(ih)
    print(res)


def test():
    for test_input, ans in zip(TEST_INPUT, ANSWER):
        ih = InputHandler(test_input, True)
        res = input_and_solve(ih)
        assert str(res) == str(ans)


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

Solution (Python):
lisST = input().split()
S=lisST[0]
T=lisST[1]
lisAB = input().split()
U = input()
A = int(lisAB[0])
B = int(lisAB[1])
if S == U:
    ansA, ansB = A-1, B
elif T == U:
    ansA, ansB = A, B-1
print(ansA, ' ', ansB)

Solution (Python):
import sys
[N, T] = list(map(str, input().split()))
[A, B] = list(map(int, input().split()))
U = input()
if (N == U):
    A -= 1
else:
    B -= 1
print("{} {}".format(A, B))
sys.stdout.flush

Solution (Python):
from collections import OrderedDict as d
a = list(map(str,input().split()))
m1 = d()
l = list(map(int,input().split()))
m1[a[0]]= l[0]
m1[a[1]] = l[1]
temp = input()
m1[temp]=m1[temp]-1
for i in m1.values():
  print(i,end=" ")

Solution (Python):
import numpy as np
 
color = input().split(" ")
count = np.array(input().split(" "), dtype="int64")
choose = input()
 
a = color.index(choose)
count[a] -= 1
print(count[0], end=" ")
print(count[1])

Solution (Python):
a = input().split()
b = input().split()
c = input()

if a[0] == c :
    ans = str(int(b[0]) - 1) + " " + b[1]
else :
    ans = b[0] + " " + str(int(b[1]) - 1)

print(ans)

Solution (Python):
def acinput():
    return list(map(int, input().split(" ")))



import numpy as np

import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
import copy
import functools

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

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

Solution (Python):
input_line_str = input().split(" ")
input_line_num = [int(i) for i in input().split(" ")]

input_line_num[input_line_str.index(input())] -= 1
print(" ".join([str(i) for i in input_line_num]))

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

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

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


print(a,b)

Solution (Python):
s = input().split()
s_=s[0]
t=s[1]
s = input().split()
a=int(s[0])
b=int(s[1])
s = input().split()
if s[0] in s_:
    print(a-1,b)
elif s[0] in 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
elif U == T:
  B-=1
else:
  print("0")

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

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

print(a, b)

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

Solution (Python):
S, T = input().split()
s_i, t_i = map(int, input().split())
U = input()

if U == S:
    print(str(s_i - 1) + " " + str(t_i))
else:
    print(str(s_i) + " " + str(t_i - 1))

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

N_S,N_T=input().split()

N_S=int(N_S)
N_T=int(N_T)
U=input()

if S==U:
	print(N_S-1,N_T)
else:
	print(N_S,N_T-1)

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

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

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

Solution (Python):
A, B = input().split()
a, b = [int(i) for i in input().split()]
s = input()
if s==A:
    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):
a,b = input().split()
x,y = [int(x) for x in input().split()]
trash = input()
if trash == a:
  print((x-1), y)
elif trash == b:
  print(x, (y-1))
else:
  print(x,y)

Solution (Python):
from sys import stdin
A, B= stdin.readline().rstrip().split()
m = [A,B]
k = list(map(int, input().split()))
l = stdin.readline().rstrip().split()
k[m.index(l[0])] = k[m.index(l[0])] -1
print(k[0],k[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(str(a)+" "+str(b))

Solution (Python):



import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    S,T = i2s().split()
    A,B = i2nn()
    U = i2s()
    d = {S:A, T:B}
    d[U] -= 1
    print(d[S], d[T])
    return

main()

Solution (Python):
S = str(input())
T = input()
arr1 = [i for i in S.split(' ')]
arr2 = [int(j) for j in T.split(' ')]
U = str(input())

if(U == arr1[1]):
	arr2[1] = arr2[1] - 1
	print(str(arr2[0])+' '+str(arr2[1]))
else:
	arr2[0] = arr2[0] - 1
	print(str(arr2[0])+' '+str(arr2[1]))

Solution (Python):
list_str = [str(e) for e in input().split()]
list_num = [int(e) for e in input().split()]
drop = [str(e) for e in input().split()]
if drop[0] == list_str[0]:
    list_num[0] = list_num[0]-1
elif drop[0] == list_str[1]:
    list_num[1] = list_num[1]-1
print('{} {}'.format(list_num[0], list_num[1]))

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

s_count = a
t_count = b

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

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

Solution (Python):
name = input().split(' ')
num  = [int(a) for a in input().split(' ')] 
trash = input()


ind = name.index(trash)
num[ind] -= 1

print(
  '{} {}'.format(num[0],num[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 = str(input())

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

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

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

U = input()

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

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

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

print(a,b)

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



print(str(d[s]) + ' ' + str(d[t]))

Solution (Python):
S, T = input().split()
A, B = [int(n) for n in input().split()]
ans = {S:A, T:B}
U = input()
ans[U] -= 1
print(ans[S], ans[T])

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

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

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

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

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

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

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

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

Solution (Python):
balls = input().split(' ')
nums = [int(x) for x in input().split(' ')]

u = input()
for i, b in enumerate(balls):
    if b == u:
        nums[i] -= 1

print(' '.join(list(map(str, nums))))

Solution (Python):
a = input().split()
b = input().split()
c = input()
if a[0] == c:
    print(str(int(b[0]) - 1) + " " + b[1])
else:
    print(b[0] + " " + str(int(b[1]) - 1))

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

Solution (Python):
def a():
    s, t  = input().split()
    s_n, t_n = input().split()
    u = input()
    if u == s:
        s_n = int(s_n) - 1
    elif t == u:
        t_n = int(t_n) - 1
    return str(s_n) + " " + str(t_n)
print(a())

Solution (Python):








import collections

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

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

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

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

Solution (Python):

H = list(map(str,input().split()))
W = list(map(int, input().split()))

color = input()


idx = H.index(color)

W[idx] = W[idx] - 1

print(W[0], W[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):
r, b= map(str, input().split())
rn, bn= map(int, input().split())
s = input()

if(s==r):
    print(rn-1, bn)
else:
    print(rn,bn-1)

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

A = int(a)
B = int(b)

if u == s:
    print(A -1, B)
else:
    print(A, B - 1)

Solution (Python):


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

U=input()

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

print(*num)

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

Solution (Python):
st = input().split()
num = [int(i) for i in input().split()]
pick = input()

if (pick == st[0]):
  print(num[0]-1, num[1])
else:
  print(num[0], num[1]-1)

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

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

Solution (Python):
S, T = list(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 = input().split()
u = input()
if u == s:
    a = int(a)
    a -= 1
else:
    b = int(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
elif ( b == e ):
  d = d - 1
print(str(c) + " " + str(d) )

Solution (Python):
S,T=list(map(str, input().split())) 
A,B=list(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):
c = input().rstrip().split(' ')
number = input().rstrip().split(' ')
num1 = int(number[0])
num2 = int(number[1])
ans = input()

if c[0]==ans:
    num1 -= 1
elif c[1]==ans:
    num2 -= 1

print(str(num1) +' '+ str(num2))

Solution (Python):
def main(s, t, a, b, u):
    d = {s: a, t: b}

    d[u] -= 1

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


if __name__ == "__main__":
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()

    main(s, t, a, b, u)

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

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

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

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

if __name__ == '__main__':
  main()

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

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

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

Solution (Python):




"""
このプログラムはPythonを書く際のテンプレとなっています。これをコピペしてコーディングを行なってください。
なお字下げしないこと！！
"""

__author_ = 'Maruta Yuzuha'
__version_ = '1.0.0'
__date__ = '2019/12/25'

def main():
    """
    ここでプログラムの解説を行う
     >>main()
    Hello world.
    0
    """
    s = input().split()
    a = list(map(int, input().split()))
    u = input()
    
    if u == s[0]:
        a[0] -= 1
    else:
        a[1] -= 1
    print(str(a[0])+' '+ str(a[1]))
    return 0

if __name__ == '__main__':
    
    

    
    
    import doctest
    doctest.testmod()

    
    import sys
    sys.exit(main())

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

Solution (Python):
s = input().split()
num = [int(i) for i in input().split()]
u = input()
num1 = num[0]
num2 = num[1]

if s[0] == u:
    nums = num1 - 1
    print("{} {}".format(nums, num2))
elif s[1] == u:
    nums = num2 - 1
    print("{} {}".format(num1, nums))

Solution (Python):
strings = input().split(' ')
A = strings[0]
B = strings[1]

strings = input().split(' ')
S = int(strings[0])
T = int(strings[1])

U = input()
  
if A == U:
    print('{0} {1}'.format(S-1, T))
elif B == U:
    print('{0} {1}'.format(S, T-1))

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

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

if t==u:
  print(a, end=" ")
  print(b-1)

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

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

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=input().split()
s_num,t_num=input().split()
s_num,t_num=int(s_num),int(t_num)
string=input()
if s==string:
    s_num-=1
else :
    t_num-=1

print(str(s_num) + ' ' + str(t_num))

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):
S,T = input().split(' ')[0:2]
A,B = map(int,input().split(' ')[0:2])
U = input()
if U == S:
    A = A - 1
if U == T:
    B = B - 1
print(str(A) + " " + str(B))

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

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

print(A, B)

Solution (Python):
s = input().split()
a = [int(n) for n in input().split()]
b = input()

if b == s[0]:
  a[0] -= 1
elif b == s[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:
    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 -= 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)