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


from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key


yn = 'YNeos'
ynflg = False
cnt = 0
ans = None

def lcm(a, b):
    return (a*b) // gcd(a,b)

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

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

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas









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


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

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

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

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


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
s1, s2 = map(str, input().split())
n1, n2 = map(int, input().split())
u = input()

if u == s1:
    print(n1 - 1, n2)
else:
    print(n1, n2 - 1)

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

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

Solution (Python):
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda x: [ni() for _ in range(x)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

s, t = nas()
a, b = na()
u = ns()

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:
    a -= 1
elif u==t:
    b -= 1

print(a, b)

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

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

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

U = input()

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

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


if __name__ == '__main__':
    main()

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(str(A)+" "+str(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):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(input()) 
def ifn(): return float(input()) 
def isn(): return input().split() 
def imn(): return map(int, input().split()) 
def fmn(): return map(float, input().split()) 
def iln(): return list(map(int, input().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, input().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD

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

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

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=list(map(int, input().split()))
U=input()
if S==U:
    print('%d %d' % (A-1, B))
elif T==U:
    print('%d %d' % (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):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

s, t = readline().decode('utf-8').split()
a, b = map(int, readline().split())
u = read().decode('utf-8').rstrip()

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

print(A, B)

Solution (Python):

def solve():
    S, T = input().split()
    A, B = map(int, input().split())
    if input()==S:
        return '{} {}'.format(A-1, B)
    else:
        return '{} {}'.format(A, B-1)

if __name__ == '__main__':
    print(solve())

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S, T = [x for x in input().split()]
    A, B = [int(x) for x in input().split()]
    U = input().strip()

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

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

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

if __name__=="__main__":
    main()

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

if u == a:
    print(s-1,t)
else:
    print(s,t-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):
import sys
input = sys.stdin.readline

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

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

Solution (Python):

a, b = input().split()
n, m = map(int, input().split())
s = input()
if s == a:
	print('{} {}'.format(n-1, m))
else:
    print('{} {}'.format(n, m-1))

Solution (Python):


def main():
    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))

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

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

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

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

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

Solution (Python):

import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

S, T = list(map(str, readline().split()))
A, B = list(map(int, readline().split()))
U = str(readline().strip())

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

if(s1==s3):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):
MOD = 1000000007
INF = float("inf")

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

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

print(a, b)

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

s = 0
t = 0

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

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

if S==U:
  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, U = map(str, input().split())
s, u = map(int, input().split())
n = input()

if n == S:
    s -= 1
else:
    u -= 1

print(s, u)

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

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

print(A, B)

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

if s==u:
	print(a-1,end=' ')
	print(b)
else:
	print(a,end=' ')
	print(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)
    elif U == T:
        print(A, B-1)
resolve()

Solution (Python):
s1,s2 = input().split()
n1,n2 = map(int,input().split())
s = input()
if s == s1:
    print(n1-1,n2)
if s == s2:
    print(n1,n2-1)

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

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

S, T = readline().strip().split()

A, B = map(int, readline().split())

U = readline().strip()

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

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 = 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
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
if u == t:
  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
if u == t:
    b -= 1

ans = [a, b]
print(*ans)

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
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    vn = vk = vn_k = 1
    for i in range(1, n+1):
        vn = vn * i % modp
        if i == k:
            vk = vn
        if i == n-k:
            vn_k = vn
    return vn * get_inv(vk, modp) * get_inv(vn_k, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp



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



main()

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

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

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=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
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):
    A -= 1
else:
    B -= 1

print(A,B)

Solution (Python):
import numpy as np

if __name__ == "__main__":
  _s, _t  = input().split()
  _a, _b = map(int, input().split())
  _u = input()

  if _s == _u:
    _a -= 1
  else:
    assert _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)
elif u == t:
    print(a, b - 1)

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

Solution (Python):
st = input().split(" ")
ab = input().split(" ")
ab[0] = int(ab[0])
ab[1] = int(ab[1])
u = input()

if st[0] == u:
    ab[0] -= 1
else:
    ab[1] -= 1

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

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

Solution (Python):

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

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

Solution (Python):
w= input().split()
wm, wn = map(int, input().split())
wi = input()

if wi == w[0]:
    wm -= 1
else:
    wn -= 1

print(wm, wn)

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

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

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)

if __name__ == '__main__':
    resolve()

Solution (Python):

from itertools import product, permutations, combinations
from bisect import bisect_right,bisect_left
INF = float('inf')

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(str(A) + " " + str(B))

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

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

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

Solution (Python):



def resolve():
    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__":
    resolve()

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

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

























def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	ST = input()
	ST = ST[:-1]
	STS = ST.split()
	A,B = inputMap()
	U = input()
	U = U[:-1]

	if U == STS[0]:
		A -= 1
	else:
		B -= 1

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

if __name__ == "__main__":
	main()

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

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

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

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

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):
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(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()
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 = str(input())

if S==U:
    print("{} {}".format(A-1, B))
elif T==U:
    print("{} {}".format(A, B-1))
else:
    print("{} {}".formata(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):
def main():
    s,t = map(str, input().split())
    a,b = map(int, input().split())
    u = input()

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




if __name__ == "__main__":
    main()

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

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

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

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

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

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

Solution (Python):
import sys
import math
import bisect

def main():
    s, t = input().split()
    A = list(map(int, input().split()))
    tmp = input()
    if tmp == s:
        A[0] -= 1
    elif tmp == t:
        A[1] -= 1
    print('%d %d' % (A[0], A[1]))

if __name__ == "__main__":
    main()

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(format,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:
    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('{} {}'.format(a,b))

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

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]

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

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

if u == s:
    n -= 1
else:
    m -= 1

print(n, m)

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

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

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

Solution (Python):
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''

gi = lambda : list(map(int,input().split()))
s, t = input().split()
a, b = gi()
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 = (st for st in input().split())
A, B = (int(ab) for ab in 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):
def main():
    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)



if __name__ == '__main__':
    main()

Solution (Python):
s1, s2 = input().split()
s1s, s2s = map(int, input().split())
a = input()

if a == s1:
  s1s -= 1
else:
  s2s -= 1
  
print("{} {}".format(s1s, s2s))

Solution (Python):


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

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

Solution (Python):
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

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

S,T = input().split()

A,B=input_int()

U=one_str()

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

Solution (Python):
import bisect
import numpy as np
import math
import itertools
def main():
    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)
    return 0


    return 0
if __name__ == '__main__':
    main()

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)


main()

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


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

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


print(a,b)

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

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

Solution (Python):
import sys
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s,t = SL()
ss,tt = IL()
n = S()

if s == n:
  ss -= 1
if t == n:
  tt -= 1
print(ss,tt)

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

import math
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):
x, y = input().split()
ans = list(map(int,input().split()))

s = input()

if s == x:
    ans[0] -= 1
else:
    ans[1] -= 1

print(" ".join(map(str, ans)))

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())
k = input()
if k == 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)