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

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

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

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

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

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

if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

















mod = 10**9 + 7

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

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

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

print(A,B)

Solution (Python):
k = list(map(str, input().split()))
v = list(map(int, input().split()))
u = str(input())

if u == k[0]:
  print(v[0]-1, v[1])
else:
  print(v[0], v[1]-1)

Solution (Python):
S,T=map(lambda x: x, input().split())
A,B=map(int,input().split())
U=input()
L=[(S,A),(T,B)]
for l in L:
  x,y=l
  if x==U:
    print(y-1, end=" ")
  else:
    print(y, end=" ")

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 = input().split()
S = s[0]
T = s[1]

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

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

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

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

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

u = input()

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S, T = S_MAP()
A, B = MAP()
U = input()

dic = defaultdict(int)
dic[S] = A
dic[T] = B
if dic[U] > 0:
    dic[U] -= 1
print(dic[S], dic[T])

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    L=list(map(str,input().split()))
    A,B=map(int,input().split())
    U=str(input())

    if U==L[0]:
        print(A-1,B)
    else:
        print(A,B-1)

resolve()

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

if __name__ == '__main__':
    main()

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

if __name__ == "__main__":
  resolve()

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s,t = input().split()
    a,b = LI()
    d = {}
    d[s] = a
    d[t] = b
    u = input()
    d[u] -= 1
    print(d[s],d[t])
    return


if __name__ == "__main__":
    solve()

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

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


if __name__ == '__main__':
    main()

Solution (Python):
s = input().split()
a = list(map(int, input().split()))
a[s.index(input())] -= 1
print(*a)

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

if t == u:
    b -= 1

print(a, b)

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

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

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

Solution (Python):
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)


args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No"):
    print([yes, no][not v])


def main():
    """エントリーポイント"""
    S, T, A, B, U = input(str, str, int, int, str)
    if (S == U):
        print(A - 1, B)
    else:
        print(A, B - 1)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

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

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

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

Solution (Python):
from pprint import pprint
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

S, T = rs().split()
A, B = rl()
U = rs()

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

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

Solution (Python):
import math

s1, s2 = input().split(" ")
a, b = map(int, input().split(" "))
c = input()

if s1 == c:
    a -= 1
if s2 == c:
    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:
        a -= 1
    else:
        b -= 1

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


main()

Solution (Python):


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


main()

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

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

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

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

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

if U == S:
  A[0] = A[0] - 1;
elif U == T:
  A[1] = A[1] - 1;

print(A[0], A[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 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):
import sys
input = sys.stdin.readline

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

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

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):
N,K = map(str, input().split());r,b = map(int, input().split());p = input()
if p == N:
    r-=1
else:
    b-=1
print(r,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
    print(a, b)
else:
    b -= 1
    print(a, b)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

if u == s:
  print(str(a-1) + " " + str(b))
elif u == t:
  print(str(a) + " " + str(b-1))

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

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

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

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

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

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

if U == S:
    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):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S, T = map(str, input().split())
A, B = MAP()
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 == s:
    print(a-1, b)
else:
    print(a, b-1)

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

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

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

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

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

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

print(*b)

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

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

dic = {s: a, t: b}
dic[u] -= 1
print(str(dic[s]) + " " + str(dic[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 = 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()

dic = {}
dic[S] = A
dic[T] = B

dic[U] -= 1

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

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

if U == S:
  print(str(A-1) + " " + str(B))
else:
  print(str(A) + " " + str(B-1))

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

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

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

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

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

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

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

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

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

Solution (Python):


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

if False: print('x'*len(input()))

if False:
    N=int(input())
    A=[int(i) for i in input().split()]
    print('YES' if len(A)==len(set(A)) else 'NO')

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

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

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

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

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

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

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S, T = sr().split()
A, B = lr()
U = sr()
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):
astr, bstr = input().split()
a,b = map(int,input().split())
target = input()

if astr == target:
  a = a-1
else:
  b = b-1

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

Solution (Python):
import os

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

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):
written = list(input().split())
balls = list(map(int, input().split()))
U = input()

for word in range(2):
  if U == written[word]:
    balls[word] -= 1
for i in balls:
  print(i, end = " ")

Solution (Python):
a,b = input().split()
x,y = map(int,input().split())
k = input()

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

Solution (Python):
a,b = input().split()
x,y = map(int,input().split())
k = input()

if a == k:
  print(x-1,y)
else:
  print(x,y-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:
    a -= 1

if u == t:
    b -= 1

print('%d %d' % (a, b))

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

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

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

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

print(a,b)

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

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

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

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

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

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

if ST[0]==U[0]:
  print(A-1,B)
else:
  print(A,B-1)

Solution (Python):
x = input()
y = input()
z = input()

x = x.split()
y = y.split()
z = str(z)

num1 = int(y[0])
num2 = int(y[1])

str1 = str(x[0])
str2 = str(x[1])

if z == str1:
    num1 = num1 - 1
    print(str(num1) + ' ' + str(num2))
elif z == str2:
    num2 = num2 - 1
    print(str(num1) + ' ' + str(num2))

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

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

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

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

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

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

Solution (Python):

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

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

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

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

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

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

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

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

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

Solution (Python):
def main():
    colors = input().split()
    nums = list(map(int, input().split()))
    d = {
        colors[i]: nums[i] for i in range(2)
        }
    colors_rm = input()
    d[colors_rm] -= 1
    print(d[colors[0]], d[colors[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 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 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):
x, y = [s for s in input().split()]
a, b = [int(s) for s in input().split()]
z = input()

temp_dict = {
    x: a,
    y: b,
}
temp_dict[z] -= 1

print(temp_dict[x], temp_dict[y])

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

Solution (Python):

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

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

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