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):
import sys
input = sys.stdin.readline
import math
def print_ans(S, T, A, B, U):
    """Test Case
    >>> print_ans("red", "blue", 3, 4, "red")
    2 4
    >>> print_ans("red", "blue", 5, 5, "blue")
    5 4
    """
    if S == U:
        A = A -1
    else:
        B = B -1
    print('{} {}'.format(A, B))


if __name__ == '__main__':
    S, T = input().rstrip().split()
    A, B = map(int, input().rstrip().split())
    U = input().rstrip()
    print_ans(S, T, A, B, U)

Solution (Python):
s1, s2 = input().split()
a, b = map(int, input().split())
s3 = input()

if s1==s3:
  print(a-1, ' ', b)
elif s2==s3:
  print(a, ' ', b-1)

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

if throw == a:
    print((n-1), m)
else:
    print(n, m-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):
s1 = input().split()
s2= s1[1]
s1=s1[0]

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

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

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

if A[0] == 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=map(str,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())

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

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

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

print(A,B)

Solution (Python):
S, T = input().split()
lis = list(input().split())
N1 = int(lis[0])
N2 = int(lis[1])
Z = input()


if Z == S:
    print(N1-1,N2)
elif Z == T:
    print(N1,N2-1)
else:
    print(N1,N2)

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):
vars = [exec("global {0}; {0}={1}".format(var, val)) or var for var, val in zip(input().split(), input().split())]

exec("{}-=1".format(input()))

print(*(eval(var) for var in vars))

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

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

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

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

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby
    
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()

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

ball_dict = {}
ball_dict[s] = a
ball_dict[t] = b
ball_dict[u] = ball_dict[u] - 1
print(ball_dict[s], ball_dict[t])

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

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

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

Solution (Python):
S, T, A, B ,U = open(0).read().strip('\n').split()
A = int(A)
B = int(B)
print(int(A) - (1 if U == S else 0))
print(int(B) - (1 if U == T else 0))

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(s) for s in input().split(" ")]
U=input()

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

print(A,B)

Solution (Python):
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

s,t=s1()
a,b=n1()
u=s0()
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 = 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 u == s:
    print('%d %d\n' % (a - 1, b))
else:
    print('%d %d\n' % (a, b-1))

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

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

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

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

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

dict = dict()

dict[S] = A
dict[T] = B

dict[U] -= 1

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

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

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

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

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

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

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

sa = a
tb = b

if s == u:
    sa -= 1
if t == u:
    tb -= 1
print(sa, tb)

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):
inputted = input().split()
S = inputted[0]
T = inputted[1]
inputted = list(map(int, input().split()))
A = inputted[0]
B = inputted[1]
U = input()

A2 = A - 1 if U == S else A
B2 = B - 1 if U == T else B

output = "{} {}".format(A2, B2)

print(output)

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(" ".join(map(str,[A-1,B])))
else:
    print(" ".join(map(str,[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 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):
ball = input().split()
num = input().split()
str = input()

a = ball[0]
b = ball[1]
n = int(num[0])
m = int(num[1])

if str == ball[0]:
    n -= 1
else:
    m -= 1

print(n,m)

Solution (Python):



def main():

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

    temp = {s: a, t: b}
    temp[u] = temp.get(u) - 1

    return " ".join([str(temp.get(s)), str(temp.get(t))])


if __name__ == '__main__':
    print(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)
else:
    ptrint(a,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 = list(input().split())
a,b = map(int, input().split()) 
u = input()

if u == s[0]:
    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):
S, T = map(str, raw_input() .split())
A, B = map(int, raw_input() .split())
U = raw_input()
if U == S:
    print A - 1, B
else:
    print A, B - 1

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


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

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

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

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

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

if __name__ == '__main__':
    main()

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:
    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):
ST= input().split()
S= str(ST[0])
T= str(ST[1])
AB= input().split()
A= int(AB[0])
B= int(AB[1])
U= input(str(""))

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

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

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

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

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

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

Solution (Python):
n , m = input().split()
A , B = input().split()
A = int(A)
B = int(B)
T = input()

if (T == n) :
    print (str(A - 1) + " " + str(B))
else :
    print (str(A) + " " + str(B - 1))

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

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

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

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

Solution (Python):
from sys import stdin

def slove():
    S, T = stdin.readline().rstrip().split()
    A, B = [int(x) for x in stdin.readline().rstrip().split()]
    U = input()

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


slove()

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

balls = dict(zip([s, t], [a, b]))
balls[u] -= 1

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

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

Solution (Python):
def q1():
    S,T = (s for s 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))


if __name__ == '__main__':
    q1()

Solution (Python):

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

balls = dict(zip([s, t], [a, b]))
balls[u] -= 1

print(balls[s], balls[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().rstrip()
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,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    S,T = input().split()
    A, B = LMIIS()
    num = {}
    num[S] = A
    num[T] = B
    num[input()] -= 1
    print(num[S], num[T])

if __name__ == '__main__':
    main()

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

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

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

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

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

if s == u:
    print(a-1, b)
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):
n = input()
(s,t) = n.split()
m = input()
(a,b)=m.split()
k = input()
if k == s:
    a_1 = int(a) - 1
    print(str(a_1)+' '+ b)
else:
    b_1 = int(b) -1
    print(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 = tuple([int(i) for i in input().split(' ')])
u = input()
if s == u:
    print(a - 1, b)
elif t == u:
    print(a, b - 1)

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

Solution (Python):
import itertools
import fractions
def main():
  s,t = map(str,input().split())
  a,b = map(int,input().split())
  u = input()
  if s == u:
    a -=1
  else:
    b -=1
  print(a,b)
if __name__ == '__main__':
  main()

Solution (Python):
inp=input()
arr1=inp.split(" ")
arr2=list(map(int,input().strip().split()))[:2]
inp1=input()
if(inp1==arr1[0]):
    arr2[0]-=1
elif(inp1==arr1[1]):
    arr2[1]-=1
print(arr2[0],arr2[1])

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=input().split()
a,b=[int(s) for s in input().split()]
U=input()
if S==U:
  a-=1
else:
  b-=1
print(*[a,b])

Solution (Python):
S, T = list(map(str, input().split()))
NS, NT = list(map(int, input().split()))
a = str(input())
if a==S:
    NS-=1
else:
    NT-=1
print(NS, NT)

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):
strbase = input().split()
base = input().split()
u = input()
a = int(base[0])
b = int(base[1])
if u == strbase[0]:
    a = a-1
if u == strbase[1]:
    b = b-1
print(a,b)

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

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

resolve()

Solution (Python):

import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    if S == U:
        A -= 1
    if T == U:
        B -= 1
    print(A,B)
    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()
num_s,num_t =map(int,input().split())
u = input()
if u == s:
    num_s -= 1
else:
    num_t -= 1
print('{0} {1}'.format(num_s , num_t))

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(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=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):
import sys

s, t = sys.stdin.readline().split()
a, b = map(int, sys.stdin.readline().split())
u = sys.stdin.readline().rstrip()

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

if __name__ ==  '__main__':
    main(a, b)

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

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

if a==e:
  print(c-1,end=" ")
  print(d)
if b==e:
  print(c,end=" ")
  print(d-1)

Solution (Python):
i=0
a=0
b=0
c=input()
while i<len(c):
	if c[i]==' ':
		break
	i+=1
s=c[0:i]
s=s.strip()
t=c[i+1:]
t=t.strip()
c=input()
i=0
while i<len(c):
	if c[i]==' ':
		break
	i+=1
aa=c[0:i]
a=int(aa.strip())
bb=c[i+1:]
b=int(bb.strip())
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()
pool1 = [S for i in range(A)]
pool2 = [T for i in range(B)]

pool = pool1 + pool2

pool.remove(U)

print(pool.count(S),pool.count(T))

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

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

print(A, B)

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

Solution (Python):
li = input().split()
li2 = list(map(int,input().split()))
c = input()
d = {li[0]:li2[0], li[1]:li2[1]}
d[c] -= 1
print(d[li[0]], d[li[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()
print(str(a)+" "+str(b-1) if u==t else str(a-1)+" "+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
print(a, b)

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

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

print(A, B)

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

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:
    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=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):
def ii():return int(input())
def iim():return map(int,input().split())
def ism():return map(str,input().split())
def iil():return list(map(int,input().split()))
s,t=ism()
a,b=iim()
u=input()

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

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

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


if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
S, T = list(input().split())
A, B = list(map(int, input().split()))
U = input()
dict = {}
dict[S] = A
dict[T] = B
dict[U] -= 1
print(dict[S], dict[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):
ST = list(map(str, input().split()))
num = list(map(int, input().split()))
U = str(input())

if U == ST[0]:
  num[0] -= 1
else:
  num[1] -= 1

num = [str(i) for i in num]
num = ' '.join(num)
print(num)

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

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

U=input()

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

print(*A)

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

array = [input() for i in range(3)]
dic_data = {}
color = array[0].split(" ")
total = array[1].split(" ")
sub   = array[2]

dic_data[color[0]] = int(total[0])
dic_data[color[1]] = int(total[1])

if sub == color[0]:
    dic_data[color[0]] = dic_data[color[0]] - 1
elif sub == color[1]:
    dic_data[color[1]] = dic_data[color[1]] - 1

print(dic_data[color[0]], dic_data[color[1]])

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

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

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

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

Solution (Python):



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

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

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

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

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

Solution (Python):

S_str,T_str = (x for x in input().split(" "))
A_S_num,B_T_num = list(map(int, input().split()))
U_S_or_T = input()


if U_S_or_T ==S_str:
    A_S_num -= 1
elif U_S_or_T == T_str:
    B_T_num -= 1
print(A_S_num,B_T_num)

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

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

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

d = {}

d[s] = a
d[t] = b

d[u] -= 1

print("{} {}".format(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 U == S:
    A -= 1
else:
    B -= 1

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

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

if x == z:
    print(str(a-1) + " " + str(b))
elif y == z:
    print(str(a) + " " + str(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):
def main():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    if U == S:
        print(str(A - 1) + " " + str(B))
    elif U == T:
        print(str(A) + " " + str(B - 1))

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

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

if u == s:
    n -= 1
elif u == t:
    m -= 1
    
print(n, m)

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)