Problem:
 Score : 100 points    Problem Statement  We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one with the string U written on it and throws it away. Find the number of balls with the string S and balls with the string T that we have now.      Constraints   S , T , and U are strings consisting of lowercase English letters.  The lengths of S and T are each between 1 and 10 (inclusive).  S \not= T  S=U or T=U .  1 \leq A,B \leq 10  A and B are integers.         Input  Input is given from Standard Input in the following format:  S  T  A  B  U       Output  Print the answer, with space in between.        Sample Input 1 red blue
3 4
red      Sample Output 1 2 4  Takahashi chose a ball with red written on it and threw it away.
Now we have two balls with the string S and four balls with the string T .       Sample Input 2 red blue
5 5
blue      Sample Output 2 5 4  Takahashi chose a ball with blue written on it and threw it away.
Now we have five balls with the string S and four balls with the string T .

Solution (Python):

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

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

Solution (Python):
s, t = 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())
n=input()
if S==n:
  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:
        A = A - 1
    else:
        B = B - 1

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


if __name__ == "__main__":
    main()

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

if U == S:
  N = N - 1

if U == T:
  M = M - 1

print(N, M)

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

Solution (Python):
import sys
import decimal 

def input():
    return sys.stdin.readline().strip()

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

    
main()

Solution (Python):
s, t = input().split()
s_num , t_num = map(int, input().split())
u = input()

if u == s:
    print(s_num-1, t_num)
else:
    print(s_num, t_num -1)

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

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

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

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

if S == U:
    a -= 1
else:
    b -= 1
print(a, b)

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


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

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

main()

Solution (Python):
s,t = input().split()
snum, tnum = map(int,input().split())
selection = input()

if (selection == s):
    print(snum-1,tnum)
else:
    print(snum,tnum-1)

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

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

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

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

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

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

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=map(str,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):
first = input().split(" ")
second = input().split(" ")
third = input()

if third == first[0]:
    print(int(second[0])-1, second[1])
else:
    print(second[0], int(second[1])-1)

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

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

print(A,B)

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

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

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

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

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

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

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

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

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

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

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

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

    print(A - (U == S), B - (U == T))


if __name__ == '__main__':
    main()

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

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    S, T = (s.decode() for s in readline().rstrip().split())
    A, B = map(int, readline().split())
    U = readline().rstrip().decode()
    if S == U:
        A -= 1
    else:
        B -= 1
    print(A, B)


if __name__ == '__main__':
    main()

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

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

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

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

if u == 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 = 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 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()
num1,num2=map(int,input().split())
throw=input()

if throw==S:
    num1-=1
else:
    num2-=1
    
print(num1,num2)

Solution (Python):
import numpy

S, T = map(str, input().split())
AB = list(map(int, input().split()))
U = input()

if U == S:
    tmp = numpy.array([1,0])
else:
    tmp = numpy.array([0,1])
print(numpy.array(AB-tmp)[0], numpy.array(AB-tmp)[1])

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

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

a = A - 1
b = B - 1

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

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

Solution (Python):
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 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 S==U:
    A-=1
if T==U:
    B-=1

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

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


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

Solution (Python):
x = list(input().split())
y = list(map(int, input().split()))
z = input()
y[x.index(z)] -= 1
print("{0} {1}".format(y[0], y[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()
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 s==u:
  print (a-1,b)
elif t==u:
  print(a,b-1)

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

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  


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

print(A - (S == U), B - (T == U))

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

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

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

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

print(a, b)

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

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

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

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

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

if __name__ == "__main__":
  resolve()

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

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

U = str(input())

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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


if __name__ == '__main__':
    resolve()

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

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

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

balls = {
    s: a,
    t: b
}

balls[u] -= 1

print('{} {}'.format(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 = 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 = list(map(int, input().split()))
    u = input()
    
    if s == u:
        a -= 1
    if t == u:
        b -= 1
    print(a,b)
    
if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

Solution (Python):
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")



def main():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()[:-1]
    if U == S:
        A -= 1
    else:
        B -= 1
    
    print(A, B)


if __name__ == '__main__':
    main()

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

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

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

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

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

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

Solution (Python):
import sys
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def ISS(): return sys.stdin.readline().rstrip().split()

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

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

f = str(input())

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

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

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

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

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

Solution (Python):
s,t = 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 = map(str,input().split())
A,B = map(int,input().split())
U = str(input())

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

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

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

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

print(a,b)

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

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

Solution (Python):
S,T = input().split()
a,b = map(int,input().split())
u = input()

if u == S:
  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 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):
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

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

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

print(a)
print(b)

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

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

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

print(A, B)

Solution (Python):
import sys
import math
from collections import deque
from collections import defaultdict

def main():
    s, t = input().split()
    a, b = list(map(int,sys.stdin.readline().split()))
    u = input()
    if u == s:
        a -= 1
    else: b -= 1
    print(a,b)
    return 0

if __name__ == "__main__":
    main()

Solution (Python):

w1, w2 = input().split()
a,b = map(int,input().split())
c = input()
l = [[w1,a],[w2,b]]
ans = ""
for i in range(2):
    x,y = l[i][0],l[i][1]
    if x==c:
        ans += str(y-1)
    else:
        ans += str(y)
    if i==0:
        ans += ' '

print(ans)

Solution (Python):
import collections
s,t = raw_input().split(' ')

a,b = map(int,raw_input().split(' '))
u = raw_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:
  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
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=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:
    print(a-1, end = ' ')
    print(b)
else:
    print(a, end = ' ')
    print(b-1)

Solution (Python):
n=2
s=[""]*n
a=[0]*n
s[:]=input().split()
a[:]=map(int,input().split())
u=input()
for ii in range(n):
  if s[ii]==u:
    a[ii]-=1
    break
print(" ".join([str(ii) for ii in a]))

Solution (Python):
S,T = input().split()
A,B = (int(x) for x in input().split())
U = input()
if U == S:
    A -= 1
    print(('{} {}'.format(A,B)))
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 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
if t==u:
    b -= 1

print(a, b)

Solution (Python):


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

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

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

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

if U == S:
    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):
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter

from functools import lru_cache

sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


s, t = input().split()
a, b = inpl()
u = input()[:-1]
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
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:
  a-=1
else:
  b-=1
print(a,b)

Solution (Python):
from sys import stdin, setrecursionlimit


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


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

Solution (Python):
import sys
input = sys.stdin.readline


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


if __name__ == '__main__':
    main()

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

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

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

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

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

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

Solution (Python):
S,T=map(str, input().split())
A,B=map(int,input().split())
U=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 = list(map(str, input().split()))
I = list(map(int, input().split()))
U = input()
print(I[0] - (U == S[0]), I[1] - (U == S[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 = map(int,input().split())
u = input()

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

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

Solution (Python):

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

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

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

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

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

Solution (Python):
S, T = input().split()
A, B = 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
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=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 = [i for i in 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):
import sys
import collections
input = sys.stdin.readline

s, t = map(str,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):
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(A,B)

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

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

Solution (Python):
color = input()

kosuu = input()

trashc = input()

_ = 0

color = color.split()
kosuu = kosuu.split()
trashc = trashc.split()


while True:
  if(trashc[0] == color[_]):
    kosuu[_] = int(kosuu[_]) -1
    break
      
  _= _+1
    
print(" ".join(map(str, kosuu)))

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

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

print('{} {}'.format(d[S], d[T]))

Solution (Python):
s, t = (x for x in raw_input().split())
a, b = (int(x) for x in raw_input().split())
u = raw_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):
    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)
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:
  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 = (int(x) for x in input().split())
U = input()
if S == U or T == U:
  print(A - int(S==U), B - int(T==U))

Solution (Python):
r,b = input().split()
n,m = map(int, input().split())
kai = input()

if r == kai:
    n-=1
    
else:
    m-=1
    
print(n,m)

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

Solution (Python):
import sys

input = sys.stdin.readline


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

    if S == U:
        ans = [A - 1, B]
    else:
        ans = [A, B - 1]

    print(*ans)


if __name__ == "__main__":
    main()

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

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