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

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

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

print(a, b)

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

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

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

if 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
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(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 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 if u == t else a-1, end = " ")
print(b-1 if u == t else 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):
from operator import xor
from functools import reduce


def resolve():
    s, t = input().split()
    a, b = map(int, input().split())
    d = {s: a, t: b}
    u = input()
    d[u] -= 1
    print(d[s], d[t])

if __name__ == "__main__":
    resolve()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

print(A,B)

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from  collections import defaultdict
from collections import Counter
import bisect
def main():
    X = LS()
    S_ = X[0]
    T = X[1]
    A, B = MI()
    U = S()
    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:
    print(a-1,b)
else:
    print(a,b-1)

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

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

print(x, y)

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

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

Solution (Python):
keys = list(map(str, input().split()))
values = list(map(int, input().split()))
rm_str = input()

dicts = {key: value for key, value in zip(keys, values)}
dicts[rm_str] = dicts[rm_str] - 1

print(' '.join([str(n) for n in list(dicts.values())]))

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

Solution (Python):
s, t = 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 = [int(x) for x in 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 = input()

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

Solution (Python):
s, t = input().split()
a, b = [int(i) for i in input().split()]
u = 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):
    a -= 1
elif(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 s == u else print(a,b-1)

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

print(str(A)+" "+str(B-1) if T==U else str(A-1)+" "+str(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(f"{a} {b}")

if __name__ == "__main__":
    main()

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

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

Solution (Python):
st = input().split()
S = st[0]
T = st[1]

ab = input().split()
A = int(ab[0])
B = int(ab[1])
U = input()

new_a = A - 1 if S == U else A
new_b = B-1 if T == U else B

print("{} {}".format(new_a, new_b))

Solution (Python):
[S, T] = [str(i) for i in input().split()]
[A, B] = [int(i) for i in 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 S == U:
    print(A-1, B)
else:
    print(A, B-1)

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

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

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

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

Solution (Python):
ri = lambda S: [int(v) for v in S.split()]
def rii(): return ri(input())

S, T = input().split()
A, B = rii()
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()

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

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

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

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

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

print(a,b)

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

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

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

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

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

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

Solution (Python):
S, T = [s for s in input().split(' ')]
A, B = [int(s) for s in input().split(' ')]
U = input()
d = {S:A,T:B}

d[U] = d[U] - 1
print('%d %d' % (d[S], d[T]))

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

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

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

Solution (Python):
import os, sys, re, math

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

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

print('%s %s' % (A, B))

Solution (Python):
keys = input().split(' ')
vals = list(map(int, input().split(' ')))
hoge = input()
print(vals[0]-(keys[0]==hoge), vals[1]-(keys[1]==hoge))

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

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

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

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

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

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

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

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

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

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


if __name__ == '__main__':
    main()

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

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)

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

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

Solution (Python):


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

Solution (Python):
s,r=input().split()
x,y=map(int,input().split())
t=input()
if(t==s):
    x=x-1
if(t==r):
    y-=1
print(x,y)

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

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

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

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

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

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

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

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

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

Solution (Python):
S, T = 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()
ST={}
ST[a], ST[b] = map(int, input().split())
ST[input()]-=1

for k,v in ST.items():
  print(v,end=' ')

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

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

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

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

if S==U:
    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):
a,b=input().split()
c,d=input().split()
e=input()
c=int(c)
d=int(d)
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:
    A=A-1
else:
    B=B-1
print(A,B)

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

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

print(a, b)

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

Solution (Python):
red, blue= input().split()
r, b = [int (x) for x in input().split()]
s = input()
if s == red:
    r = r - 1
else:
    b = b - 1
print(r, end=" ")
print(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 U==S:
  print(A-1, B)
elif U==T:
  print(A, B-1)

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

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

print(a,b)

Solution (Python):
S, T = input().rstrip().split()
A, B = [int(v) for v in input().rstrip().split()]
U =  input().rstrip()
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):
    print(A-1,B)
elif (U == T):
    print(A,B-1)

Solution (Python):
list1=input().split()
S=list1[0]
T=list1[1]
A,B=map(int,input().split())
U=input()
if U==S:
  a=A-1
  print(f"{a} {B}")
if U==T:
  b=B-1
  print(f"{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) 

'''例
入力
S = red , T = blue
A = 3 , B = 4
U = red

UはSと同じだから,Sに対応するAから1引いてA(2)とB(4)を出力する

出力
2 4
'''

Solution (Python):
a, b = input().split()
na, nb = map(int, input().split())
c = input()
if a == c:
  print(na - 1, nb)
else:
  print(na, nb - 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 = list(map(str, input().split()))
A = list(map(int, input().split()))
U = input()

ind = S.index(U)

A[ind] -= 1

print(" ".join(list(map(str, A))))

Solution (Python):

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


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


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


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


def main():
    solve()


if __name__ == '__main__':
    main()

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

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

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

u=input()

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

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

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

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

Solution (Python):
s, t = 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()
D = {S:A, T:B}
D[U] -= 1
print(D[S],D[T])

Solution (Python):
N_dict  = {i:0 for i in list(map(str,input().split()))}
N_List = list(map(int,input().split()))
ct = 0
for i in N_dict.keys():
    N_dict[i] = N_List[ct]
    ct += 1

N_dict[str(input())] -= 1
print(" ".join(list(map(str,N_dict.values()))))

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

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))

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

Solution (Python):
a, b = input().split()
x, y = map(int, input().split())
c = input()
if a == c:
  print("{} {}".format(x-1, y))
elif b == c:
  print("{} {}".format(x, y-1))
else:
  print("{} {}".format(x, y))

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

Solution (Python):
words = list(map(str,input().split()))
score = list(map(int,input().split()))
word = input()
if word == words[0]:
    print(score[0]-1,score[1])
else:
    print(score[0],score[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 = 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)
else:
    print(A, B-1)

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

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

Solution (Python):
from sys import stdin 

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)

if __name__ == "__main__":
    main()

Solution (Python):

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


if __name__ == "__main__":
    main()

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

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

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

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

print(a,b)

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

Solution (Python):
import sys
S, T = next(sys.stdin).strip().split()
A, B = map(int, next(sys.stdin).split())
U = next(sys.stdin).strip()

if U == S:
  A -= 1
elif U == T:
  B -= 1
else:
  raise ValueError

print(A, B)

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

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

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

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

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

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

print(f'{A} {B}')

Solution (Python):

colors  = list(input().split())
numbers = list(map(int, input().split()))
u = input()
numbers[colors.index(u)] -= 1
print(' '.join([str(e) for e in numbers]))

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

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

if '__main__' == __name__:
    resolve()

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

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

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