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):
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 = input().split()
a, b = map(int, input().split())
i = (s==input())
print(a-i, b-1+i)

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

Solution (Python):
S, T = input().split(' ')
A, B = list(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())
h = input()
if s == h and a >= 1:
    a -= 1
if t == h and b >= 1:
    b -= 1
print(a, b)

Solution (Python):
from sys import stdin
S, T = stdin.readline().rstrip().split()
A, B = [int(_) for _ in stdin.readline().rstrip().split()]
U = stdin.readline().rstrip()
if U == S:
    print(A-1, B)
else:
    print(A, B-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)
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):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s, t = list(map(str, readline().rstrip().decode('utf-8').split()))
    a, b = list(map(int, readline().split()))
    if s == str(readline().rstrip().decode('utf-8')):
        print(a - 1, b)
    else:
        print(a, b - 1)


if __name__ == '__main__':
    solve()

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

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

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

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

Solution (Python):

s,_ = input().split()
a,b = map(int, input().split())
print(*[[a,b-1],[a-1,b]][s==input()])

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):
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial

sys.setrecursionlimit(10**7)
S, T = input().split()
A, B = map(int, input().split())
s = input()

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

print(a, b)

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

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

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

Solution (Python):

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

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("{} {}".format(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 = 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):
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):
from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key
import heapq


def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()

def main():
    s, t = rsa()
    a, b = ria()
    u = rs()
    if s == u: a -= 1
    if t == u: b -= 1
    print("{0} {1}".format(a,b))


if __name__ == "__main__":
    main()

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

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

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

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

if S == U: A -= 1
if T == U: B -= 1
print("{0} {1}".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):
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
elif T==U:
    B-=1
else:
    pass

print("{:0} {:1}".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 = list(input().split())
a,b = list(map(int,input().split()))
u = input()

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

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy


from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush

sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])
 
def main():
    s,t = inpls()
    a,b = inpm()
    u = str(input())
    if s==u:
        print(a-1)
        print(b)
    else:
        print(a)
        print(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)
elif u == t:
    print(a, b-1)
else:
    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('{0} {1}'.format(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):
a=input().split()
b=list(map(int,input().split()))
c=input()
if c==a[0]:
  b[0]-=1
if c==a[1]:
  b[1]-=1
print(str(b[0])+' '+str(b[1]))

Solution (Python):
from sys import stdin
S, T = stdin.readline().rstrip().split()
A, B = [int(x) for x in stdin.readline().rstrip().split()]
U = stdin.readline().rstrip()
if S == U:
    A -= 1
else:
    B -= 1

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

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

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
    U = '0'

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

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

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

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

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

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

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

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

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

else:
    print(a, b-1)

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

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

Solution (Python):


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

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

print(a,b)

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

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

Solution (Python):
def main(S,T,A,B,U):
    if S == U:
        print(A-1,B)
    if T == U:
        print(A,B-1)
    
S,T = input().split()
A,B = map(int, input().split())
U = input()
main(S,T,A,B,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):
from heapq import heappush,heappop
import queue
import re
import math
import functools


def i_raw():
    return int(input())

def ss_raw():
    return input().split()

def is_raw():
    return list(map(int, ss_raw()))

INF = 1<<29

def make1d_arr(n,val=INF):
    return [val for i in range(n)]

def make2d_arr(h,w,val =INF):
    return [[val for i in range(w)]for i in range(h)]

def gcd (a,b):
    if(b==0):
        return a
    return gcd(b,a%b)


def main():
    S,T = ss_raw()
    A,B = is_raw()
    U = input().strip()
    if U==S:
        return " ".join(map(str,[A-1,B]))
    else:
        return " ".join(map(str,[A,B-1]))  


print(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 = [int(x) for x in input().split()]
U = input()

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

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

Solution (Python):
import sys

read = sys.stdin.buffer.read

inputs = sys.stdin.buffer.readlines






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)
	
	
	
	
	
	
if __name__ == "__main__":
	main()

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):
input1 = input()
s = str(input1).split(' ')[0]
t = str(input1).split(' ')[1]
input2 = input()
a = int(str(input2).split(' ')[0])
b = int(str(input2).split(' ')[1])
u = str(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 s == u:
    print(a - 1, b)
else:
    print(a, b - 1)

Solution (Python):

import sys


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

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



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

if __name__ == '__main__':
    main()

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

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

print(a, b)

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

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

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

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

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

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

Solution (Python):
a = input()
a = a.split()
b = input()
b = b.split()
c = input()
dic = {a[0]:int(b[0]),a[1]:int(b[1])}
dic[c] = dic[c]-1
print(str(dic[a[0]])+" " +str(dic[a[1]]))

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

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

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

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

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

print(' '.join(map(str, [A, B])))

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

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


import sys
import os

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

def main():
    s, t = sys.stdin.readline().split()
    a, b = [int(x) for x in sys.stdin.readline().split()]
    u = sys.stdin.readline().strip()

    a_, b_ = solve(s, t, a, b, u)

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

if a==delete_one:
    a_num-=1
else:
    b_num-=1
print(a_num,b_num)

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

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

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

if U == 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):
st=input().split()
s=st[0]
t=st[1]
ab=input().split()
a=int(ab[0])
b=int(ab[1])
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(str(a-1)+" "+str(b))
else:
    print(str(a)+" "+str(b-1))

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

S = a[0]
T = a[1]

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

c = input()

for i in range(2):
    if(c == a[i]):
        b[i] -= 1

print("%d %d" % (b[0], 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
elif 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)
elif T == u:
    print(A, B-1)

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

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

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

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

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

if(s==str):
    a-=1
else:
    b-=1

print(a,b)

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

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

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

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

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):
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):
a,b=input().split()
c,d=map(int,input().split())
if input()==a:
    print(c-1,d)
else:
    print(c,d-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):
'''
red blue
3 4
red
'''
a, b = [x for x in input().split()]
an, bn = [int(x) for x in input().split()]
threw = input()
if threw == a:an -= 1
else:
    bn -= 1
print(an, bn)

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

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

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

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

Solution (Python):
S, T= input().split()
n_s, n_t = list(map(int, input().split()))
U = input()
if U == S:
    n_s -= 1
else:
    n_t -= 1
print(str(n_s) + ' ' + str(n_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):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys





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

S, T = readline().decode('utf8').split()
A, B = map(int, readline().split())
U = readline().decode('utf8').strip()
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:
    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 = 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
if t==u:
    b-=1
print(a,b)

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

import copy
import random
import bisect 
import fractions 
import math
import sys
import collections

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

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

S,T = list(map(str, sys.stdin.readline().split()))
A,B = LI()
U = str(input())

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

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

Solution (Python):
import sys

def main():

    

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

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

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

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


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

print(A, B, sep = " ")

Solution (Python):
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()
    if s == u:
        a = max(0, a-1)
    else:
        b = max(0, 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()
print(str(a-1)+' '+str(b) if s==u else str(a)+' '+str(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

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

A,B = int(A),int(B)

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

print(A,B)

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

print(str(a1) + " " + str(b1 - 1) if input() == b else str(a1 - 1) + " " + str(b1))

Solution (Python):
s,t = input().split()
N,M = list(map(lambda x:int(x),input().split()))

u=input()

print(N-(s==u),M-(t==u))

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

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

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

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

print(a,b)

Solution (Python):
s,a,u=open(0)
*a,=map(int,a.split())
a[u in s]-=1
print(*a)

Solution (Python):

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

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

print(a, b)

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

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

print(_dict[S], _dict[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 = list(map(int, input().split()))
U = input()

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

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

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

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

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

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

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

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

u = input()

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

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

dict = {S: a, T: b}
U = input()
dict[U] -= 1

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

Solution (Python):
S, T = input().split()
N = {s : int(n) for s, n in zip((S, T), input().split())}
N[input()] -= 1
print(N[S], N[T])

Solution (Python):
s,t = [i for i in input().split()]

a,b = [int(i) for i in input().split()]

ball = input()


if ball == 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):
a, b=input().split()
x,y = map(int,input().split())
i=input()

if a == i:
    print(x-1, y)
else:
    print(x, y-1)

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


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

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

Solution (Python):
line = input()
line = line.split(" ")
S = line[0]
T = line[1]
line = input()
line = line.split(" ")
A = int(line[0])
B = int(line[1])
U = input()
if U == S:
	A-=1
else:
	B-=1
print("{} {}".format(A,B))

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

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

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

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

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

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

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