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 = 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):
P = [str(p) for p in input().split()]
S = P[0]
T = P[1]

Q = [int(q) for q in input().split()]
A = Q[0]
B = Q[1]

U = str(input())

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

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

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

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

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

import sys


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



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

if __name__ == '__main__':
    main()

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

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

print(ans)

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

Solution (Python):
T = input().split(" ")
s = T[0]

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

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

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

Solution (Python):

from sys import stdin
from copy import deepcopy
from functools import reduce
from fractions import gcd
import math
import itertools
from collections import Counter
from itertools import chain  
from heapq import heappush, heappop

"""
N = int(input())
A, B = map(int,input().split())
A = list(map(int,input().split())) 
A = [int(input()) for _ in range(N)] 
lst = [list(map(int,input().split())) for i in range(M)] 
"""

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):
first = input().split(' ')
second = input().split(' ')

name_1 = first[0]
count_1 = int(second[0])
name_2 = first[1]
count_2 = int(second[1])

name = input()

if name_1 == name:
    count_1 -= 1
else:
    count_2 -= 1

print(count_1, count_2)

Solution (Python):
input_first = input().split()
input_second = input().split()
S = input_first[0]
T = input_first[0]
A = input_second[0]
B = input_second[1]

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

input_U = input()

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

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

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


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

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

def solve(S, T, A, B, U):
    if U == S:
        A -= 1
    if U == T:
        B -= 1
    return A, B


if __name__ == '__main__':
    inputs = read()
    print("{} {}".format(*solve(*inputs)))

Solution (Python):
from sys import stdin

if __name__ == '__main__':
    S, T = stdin.readline().rstrip().split()
    A, B = [int(x) for x in stdin.readline().rstrip().split()]
    U = stdin.readline().rstrip()
    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 s==u:
  a-=1
elif t==u:
  b-=1
print(a,b)

Solution (Python):
def main():
	s = list(map(str,input().split()))
	a = list(map(int,input().split()))
	u = str(input())
	
	
	a[s.index(u)] -= 1
 
	print(' '.join(map(str, a)))
 
	
 
if __name__ == '__main__':
	main()

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

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

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

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

    if ss == s:
        print(str(a-1) + ' ' + str(b))
        return
    else:
        print(str(a) + ' ' + str(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 = a-1
elif u == t:
    b = b-1

print(a,b, end=" ")

Solution (Python):
input_s = input().split()
s = input_s[0]
t = input_s[1]

input_a = input().split()
a = int(input_a[0])
b = int(input_a[1])

u = input()

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

result = str(a)+" "+str(b)

print(result)

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

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

if a[0] == c[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:
  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()
dic={S:A,T:B}
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 U == S:
    print(A-1,B)
else:
    print(A,B-1)

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

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

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

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

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

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

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


if __name__ == '__main__':
    main()

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

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):
strS,strT = input().split()
intA,intB = map(int,input().split())
strU = input()

if strU == strS:
    intA -= 1
elif strU == strT:
    intB -= 1
print(intA,intB)

Solution (Python):
def main():
    hoge = input().split()
    huga = list(map(int, input().split()))
    poyo = input()
    if hoge[0] == poyo:
        huga[0] = huga[0] -1
    else:
        huga[1] = huga[1] -1
    print(huga[0],huga[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(" ")
S_num, T_num = input().split(" ")
S_num = int(S_num)
T_num = int(T_num)
U = input()
if S == U:
  print(str(S_num-1)+ " "+str(T_num) )
if T == U:
  print(str(S_num)+ " "+str(T_num-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 = [int(i) for i in input().split()]
U = input()

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

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

Solution (Python):
ball = input().split(" ")
S = str(ball[0])
T = str(ball[1])
ball_number = input().split(" ")
A = int(ball_number[0])
B = int(ball_number[1])
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
else:
    b=b-1
ans=""
ans=str(a)+" "+str(b)
print(ans)

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

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

Solution (Python):
s,t = map(str,input().split())
A = list(map(int,input().split()))
r = input()

if r == s:
  A[0] -= 1
elif r == t:
  A[1] -= 1
print(A[0],A[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 = A-1
if U == T:
  B = B-1

print(A,B)

Solution (Python):
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
l = input().split()
s,t = l[0],l[1]
a ,b = i2()
u = input()
if s == u:
    print(a-1,b)
else:
    print(a,b-1)

Solution (Python):
color = input().split()
num = list(map(int,input().split()))
c = input()
if c == color[0]:
    num[0] -= 1
else:
    num[1] -= 1
print(str(num[0])+" "+str(num[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:
    A-=1
else:
    B-=1
print(A, end=" ")
print(B)

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

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

Solution (Python):


''' 
------------------------
author : iiou16
------------------------
'''


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

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

Solution (Python):
s,t=(i for i in input().split())
n,m=(int(i) for i in input().split())
u=input()
if u==s:
  n-=1
elif u==t:
  m-=1
print(n,m)

Solution (Python):

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

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

Solution (Python):
S, T = [x for x in input().split()]
A, B = [int(x) for x in input().split()]
U = input()
if S == U:
  print(A-1, end=' ')
  print(B)
else:
  print(A, end=' ')
  print(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):
def main():
    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)


if __name__ == "__main__":
    main()

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

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

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

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

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

Solution (Python):
import sys


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

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


if __name__ == '__main__':
    main()

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(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 s == u: print(str(a - 1) + ' ' + str(b))
if t == u: 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:
  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(str(A) + " " + str(B))

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

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

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

if 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:
  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))
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
from collections import deque, Counter, defaultdict
from fractions import gcd
input = sys.stdin.readline

def eprint(s):
    if type(s) != type('str'):
        s=str(s)

    sys.stderr.write(s+'\n')
    return

def main():
    s,t = input().split()
    a,b  = map(int, input().split())
    u = input().split('\n')[0]
    
    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):



import sys
readline = sys.stdin.readline
read = sys.stdin.read



s,t,a,b,u = read().split()

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

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

Solution (Python):

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

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

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

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

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

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

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

answer = []

if s == u:
    answer = [a-1, b]
else:
    answer = [a, b-1]
print(" ".join(map(str, answer)))

Solution (Python):


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

ab_list[n_list.index(u)] = ab_list[n_list.index(u)] - 1
ans = " ".join([str(x) for x in ab_list])

print(ans)

Solution (Python):
(n, k), *D,  = [s.split() for s in open(0)]

d = dict()
d[n] = int(D[0][0])
d[k] =  int(D[0][1])
d[D[1][0]] -= 1

print(d[n], d[k])

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

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

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

print(a, b)

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

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

print(' '.join(map(str, [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):
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()

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 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, sep=' ')

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

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

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

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

Solution (Python):
import sys
from io import StringIO
import unittest

def resolve():
    a,b = list(map(str,input().split()))
    c,d = list(map(int,input().split()))
    e=input()

    if a==e:
        c-=1

    if b==e:
        d-=1 

    print(str(c)+" "+str(d))

    return

resolve()

Solution (Python):

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

cc = input()

if cc == s:
    u -=1
else:
    v -=1

print(str(u)+" "+str(v))

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

m = {s: a, t: b}
m[u] -= 1

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

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

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

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

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

arr = input().split(" ")
A = int(arr[0])
B = int(arr[1])

U = input()

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

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


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


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

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

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

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

a=A
b=B

if S==U:
    a=a-1
elif T==U:
    b=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):
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


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



def B():
    return



def C():
    return



def D():
    return



def E():
    return



def F():
    return



if __name__ == "__main__":
    A()

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


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

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

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 permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
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 LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

dic = {s: A, t: B}
u = input()
dic[u] = dic[u] - 1
print(dic[s], dic[t])

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

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

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

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

print(a, b)

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


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

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

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

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


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

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

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

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

print(a,b)

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

Solution (Python):
s = input().split()
a = [int(i) for i in input().split()]
u = input()
a[s.index(u)] -= 1
print(*a)

Solution (Python):
ans = input().split()
S, T = list(map(int, input().split()))
rem = input()
if rem == ans[0]:
    S -= 1
elif rem == ans[1]:
    T -= 1
print("{} {}".format(S, T))

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

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

Solution (Python):
str1, str2 = input().split()
a, b = map(int, input().split())

u = input()

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

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

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


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

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

if U == S:
    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("{} {}".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 = 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):
a,b = input().split()

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

kk = input()

if kk == a:
  s -=1
elif kk == b:
  t -= 1
  
print("{0} {1}".format(s,t))

Solution (Python):

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