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 = input()
t = s.split()
a, b = [int(x) for x in input().split()]
u = input()
if u==t[0]:
    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):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


s, t = LS()
a, b = LI()
x = S()
if s == x:
    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 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):
def main():
    str_list = list(input().split(' '))
    a, b = map(int, input().split(' '))
    if str_list.index(input()):
        b -= 1
    else:
        a -= 1
    print(a, b)


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):
import sys

s, t = sys.stdin.readline().split()
a, b = map(int, sys.stdin.readline().split())
u = sys.stdin.readline().rstrip()

def main():
    if u == s:
        return a - 1, b
    else:
        return a, b - 1

if __name__ == '__main__':
    ans = main()
    print(*ans, sep=' ')

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)


if __name__ == "__main__":
    main()

Solution (Python):

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

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

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S, T, A, B, U):
    if S == U:
        A -= 1
    else:
        B -= 1
    return '%d %d' % (A, B)


def main():
    S, T = read_str_n()
    A, B = read_int_n()
    U = read_str()
    print(slv(S, T, A, B, U))


if __name__ == '__main__':
    main()

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

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

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

print(a,b)

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

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

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

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

if 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:
  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 = (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):
s1, s2 = (i for i in input().split())
a, b = (int(i) for i in input().split())
u = input()

if u == s1:
  print(a-1, b)
elif u == s2:
  print(a, b-1)
else:
  print(a, b)

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

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

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

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

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

Solution (Python):

def main():
    from sys import stdin, setrecursionlimit
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

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

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

if __name__ == '__main__':
    main()

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

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

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

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

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))



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

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

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s,t = input().split()
a,b = mi()
ss  = input()

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):

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

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

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

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == T:
    print(str(A) + " " + str(B - 1))
else:
    print(str(A - 1) + " " + 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())
d = {s:a,t:b}
d[input()] -= 1
print("{} {}".format(d[s],d[t]))

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

U = input()

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

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

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

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

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

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

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

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

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


def main():
    a, b = input().split()
    n, m = map(int, input().split())
    u = input()
    
    if a == u:
        print(n - 1, m)
    else:
        print(n, m-1)
main()

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

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()
a = a if u != s else a - 1
b = b if u != t else b - 1
print("{} {}".format(a, b))

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

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

Solution (Python):
import sys
readline = sys.stdin.readline
S, T = readline().strip().split()
A, B = map(int, readline().split())
if readline().strip() == 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 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(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)
elif U==T:
    print(A, B-1)

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

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

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

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

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

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

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

if s == x:
	a -= 1
elif t == x:
	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:
	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:
    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):

from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def main():
    s,t = input().split()
    a,b = mi()
    u = input()

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

    print(a,b)



main()

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

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

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

Solution (Python):

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

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

print(A,B)

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

main()

Solution (Python):


from collections import deque, defaultdict
import itertools as ite
import sys
import math
from decimal import *

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

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

Solution (Python):
def examA():
    S, T = LSI()
    A, B = LI()
    U = SI()
    if S==U:
        print(A-1,B)
    else:
        print(A,B-1)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

"""

"""

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

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

Solution (Python):
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

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

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

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

print(a, b)

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

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

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

print(a, b)

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

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

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

ST = {S:0, T:1}
AB[ST[U]] -= 1

print(*AB)

Solution (Python):







import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

S, T= input().split()
A, B = splitintinput()
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 solve():
    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__':
    solve()

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


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

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

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

print(a, b)

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

Solution (Python):
S, T = 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):


iim = lambda: map(int, input().rstrip().split())

def resolve():
    S, T = input().rstrip().split()
    A, B = iim()
    U = input().rstrip()

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

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)
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
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

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

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = {False: 'No', True: 'Yes'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False



def main():
    S, T = MS()
    A, B = MI()
    U = input()

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


if __name__ == '__main__':
    main()

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

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


if __name__ == '__main__':
    main()

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

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


s,t = map(str, stdin.readline().rstrip().split())

a,b = map(int, stdin.readline().rstrip().split())
u = str(stdin.readline().rstrip())

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)
else:
    print(A, B - 1)

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

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

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

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

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

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

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

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

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