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

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

    if U == S:
        A -= 1
    elif U == T:
        B -= 1
    
    ans = str(A) + " " + str(B)
    print(ans)

if __name__ == '__main__':
    main()

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

ans = a-(s == u)

print("{} {}\n".format(a-(s == u), b-(t == u)))

Solution (Python):

import sys






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

    ball = {}
    ball[S] = A
    ball[T] = B
    ball[U] -= 1

    print("{} {}".format(ball[S], ball[T]))


main()

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

Solution (Python):
Scolor, Tcolor = input().split()
S, T = map(int, input().split())
U = input()

if U == Scolor:
  print(S-1, T)
else:
  print(S, T-1)

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

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] = [i for i in input().split()]
[A, B] = [int(i) for i in input().split()]
U = input()

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

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

Solution (Python):
a,b = input().split()
A,B = map(int, input().split())
U = input()

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

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







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

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

    print(A, B)


if __name__ == '__main__':
    main()

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

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

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

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

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

print(a,b)

Solution (Python):
s,t= map(str,input().split())
a,b=map(int,input().split())
u=input()
if u == s:
    print("{} {}".format((a-1),b))
elif u==t:
    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):
import queue
import copy
import math
from collections import deque
import bisect


s, t = map(str, input().split())

n1, n2 = map(int, input().split())

color = input()

dict = {}
dict[s] = int(n1)
dict[t] = int(n2)

dict[color] = dict[color] - 1

print(str(dict[s]) + " " + str(dict[t]))

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

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

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

print(" ".join(list(map(str, [a,b]))))

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

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

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

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

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

Solution (Python):
S, T = 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):
def main(s,t,a,b,u):
    if u == s:
        return "{0} {1}".format(a-1,b)
    else:
        return "{0} {1}".format(a,b-1)

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

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

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

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 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 functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    ST = S_LIST()
    A, B = MAP()
    U = INPUT()

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

    print(A, B)


if __name__ == '__main__':
    main()

Solution (Python):
strs = input().split()
nums = list(map(int, input().split()))
target = input()

if target == strs[0]:
    nums[0] -= 1
else:
    nums[1] -= 1

print(str(nums[0])+' '+str(nums[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):
import sys

stdin = sys.stdin

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


s, t = ns().split()
a, b = na()
u = ns()
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):
S, T = input().split()
A, B = [int(i) for i in 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()
m = {}
m[s] = a
m[t] = b

m[u] -= 1

print(m[s], m[t])

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

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

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

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()
ans=0
if u  in s:
  a-=1
if u in t:
  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:
    A = A - 1
else:
    B = B - 1

print(A, B)

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

Solution (Python):
import sys
input = sys.stdin.readline
s,t=input().split()
a,b=map(int,input().split())
u=input().strip()

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

Solution (Python):
S,T = input().split()
s,t = map(int,input().split())
U = input()

if U==S:
  s -= 1
else:
  t -= 1
  
print(s,t)

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

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

Solution (Python):

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

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

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

x,y = map(int,input().split())

u = input()

if a == u:
    print(str(x-1) + " " + str(y))
else:
    print(str(x) + " " + str(y-1))

Solution (Python):
def run():
  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__':
    run()

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

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


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

Solution (Python):
S,T = input().split()
s_num,t_num = map(int,input().split())
U = input()

if S==U:
    print(str(s_num-1)+" "+str(t_num))
else:
    print(str(s_num)+" "+str(t_num-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 U == S:
  A -= 1
elif U == T:
  B -= 1
print(A,B)

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

sn, tn = [int(j) for j in input().split()]

u = input()

if (u == s):
    print(sn-1, tn)
else:
    print(sn, tn-1)

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

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

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

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

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

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

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

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

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


print(a, end=' ')
print(b)

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

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

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

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

Solution (Python):
T = input().split()
A = [int(a) for a in input().split()]
B = input()
if T[0] == B:
	print(A[0]-1,A[1])
else:
	print(A[0],A[1]-1)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(100000)

def ii(): return int(input())
def iis(): return input().split()
def imi(): return map(int,iis())
def iil(): return list(imi())

s,t = input().split()
a,b = imi()
u = {s:a,t:b}
u[input()] -= 1
print(u[s], u[t])

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

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

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

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

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

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(str(a)+" "+str(b))

Solution (Python):
a = [s for s in input().split()]
N,Q = map(int, input().split())
t = input()

if t == a[0]:
    print(N-1, Q)
else:
    print(N, Q-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("{} {}".format(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)
    elif T == U:
        print(A, B-1)
    else:
        print(A, B)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
a = input().split()
b = [int(i) for i in input().split()]
c = input()

if c == a[0]:
  print(str(b[0] - 1) + " " + str(b[1]))
else:
  print(str(b[0]) + " " + str(b[1] - 1))

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

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

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

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

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

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

Solution (Python):

if __name__ == '__main__':

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

if x==s:
  a-=1
else:
  b-=1
print("{} {}".format(a,b))

Solution (Python):

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

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

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

print(A, B)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

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

main()

Solution (Python):
S, T = [str(x) for x in input().split()]
A, B = [int(x) for x in 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):
colors = list(map(str,input().split()))
count = list(map(int,input().split()))
A = input()
if colors[0] == A:
    print(count[0]-1,count[1])
else:
    print(count[0],count[1]-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, 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 fractions import gcd
 
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()

if s == u and t == u:
    
    a = a-1
    b = b -1
elif s == u:
    
    a = a - 1
elif t==u:
    
    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):
x,y = map(str,input().split())
a,b = map(int,input().split())
c = input()
if c == x:
    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 = list(map(int,input().split()))
if input() == S:
    print(A-1,B)
else:
    print(A,B-1)

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

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

nokori = {S:A, T:B}

nokori[U] -= 1

print(str(nokori[S]) + " " + str(nokori[T]))

Solution (Python):
inputf = input

a,b = inputf().split(' ')
a_, b_ = inputf().split(' ')
a_ = int(a_)
b_ = int(b_)
c = inputf()

if c==a:
    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=[int(i) for i in input().split()]
U = input()

if U==S:
    A=A-1
if U==T:
    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:
    print(a-1)
    print(b)
else:
    print(a)
    print(b-1)

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

    if u==s:
        print("{} {}".format(a-1,b))
    else:
        print("{} {}".format(a,b-1))

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

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

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

Solution (Python):
def solve():
    S, T = [_ for _ in raw_input().split()]
    A, B = [int(_) for _ in raw_input().split()]
    U = raw_input()
    if U == S:
        print A - 1, B
    elif U == T:
        print A, B - 1

if __name__ == '__main__':
    solve()

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

numa, numb = map(int,input().split())

pick = input()

if pick == a:
    print(str(numa - 1) + ' ' + str(numb))
else:
    print(str(numa) + ' ' + str(numb - 1))

Solution (Python):
import unittest


class TestA(unittest.TestCase):
    def test_1(self):
        
        self.assertEqual(True, False)


def solve():
    s, t, a, b, u = read()
    result = think(s, t, a, b, u)
    write(result)


def read():
    s, t = read_line().split(" ")
    a, b = read_int(2)
    u = read_line()
    return s, t, a, b, u


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


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


def write(result):
    print(result[0], result[1])


if __name__ == '__main__':
    
    solve()

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

Solution (Python):
import sys
sys.setrecursionlimit(int(1e6))

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

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

print(A, B)

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

print(a, b)

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

Solution (Python):

import sys
import numpy as np
from collections import deque
from itertools import combinations
sys.setrecursionlimit(10**9)


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

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




if __name__ == "__main__":
  main()

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

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

Solution (Python):


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

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

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

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

print(n[0], n[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):
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

s,t = input().split()
a,b = inm()
u = ins()
if u==s:
    print("{} {}".format(a-1,b))
else:
    print("{} {}".format(a,b-1))

Solution (Python):
def main():
    strings = input().split(" ")
    A, B = map(int, input().split(" "))
    U = input()
    if U == strings[0]:
        A -= 1
    else:
        B -= 1
    print(A, B)


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	S,T = map(str, sys.stdin.readline().split())
	A,B =MI()
	d = {S:A,T:B}
	U = IS()
	d[U]-=1
	print("{} {}".format(d[S], d[T]))

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

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

a, b = int(a), int(b)

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

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

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

    print(A,B)


if __name__ == "__main__":
    main()

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

ab[st.index(u)] -= 1
print(ab[0], ab[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):

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
s,t=nm()
a,b=map(int, input().split())
u=input()

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

Solution (Python):
import numpy as np

A, B = input().split()
x, y = map(int, input().split())
U = input()

if U == A:
	print(x-1, y)
else:
	print(x, y-1)