peterverebics/CodeNet_Python_118 huggingface dataset:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

if u == s:
    print(str(a-1) + ' ' + str(b))
else:
    print(str(a) + ' ' + str(b-1))
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))
s,t=input().split()
a,b=map(int,input().split())
u=input()
if u==s:
  a-=1
else:
  b-=1
print(a,' ',b)
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s,t = input().split()
a,b = LI()
u = input()
if s == u:
    a -= 1
elif t == u:
    b -= 1
print(a,b)
sp=input().split()
A,B=list(map(int,input().split()))
s=input()
if sp[0]==s:print(A-1,B)
elif sp[1]==s:print(A,B-1)
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)
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)
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()
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)
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)
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))
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	n = len(l)
	

s,t = map(str, stdin.readline().rstrip().split())
a,b = map(int, stdin.readline().rstrip().split())
u = input()
if(u == s):
	a -= 1
else:
	b -= 1
print(a,b)
S, T = input().split()
A, B = map(int, input().split())
U = input()

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

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

if S==U:
    a-=1
else:
    b-=1
    
print('{} {}'.format(a,b))
import sys
sys.setrecursionlimit(10**9)
from collections import defaultdict

IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())

s=list(IAS())
n=list(IA())
u=input()

for i in range(0,2):
    if s[i]==u:
        n[i]-=1
print(str(n[0])+" "+str(n[1]))

N=int(100005)
a=[int(0) for i in range(N)]
S, T = input().split()
A, B = map(int, input().split())
U = input()
print(A if U == T else A-1, B if U == S else B-1)
s = input().split()
t = list(map(int,input().split()))
d = {s[0]:t[0],s[1]:t[1]}
d[input()]-=1
print(d[s[0]], d[s[1]])
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

if u == s:
    print(str(a - 1) + ' ' + str(b))
else:
    print(str(a) + ' ' + str(b-1))
a,b = input().split()
c,d = map(int,input().split())
e = input()
if a == e:
  c -= 1
else:
  d -= 1
print(c,d)
S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
  A = A - 1
else:
  B = B - 1
  print(' '.join(map(str, [A, B])))
print("enter S and T value")
S, T = input().split()
print("enter A and B value")
A, B = map(int, input().split())
print("enter U value")
U = input()
if S==U:
  print("{} {}".format(A-1,B))
else:
  print("{} {}".format(A,B-1))
s,t=input().split()
a,b=map(int,input().split())
u=input()
if len(u)==len(s):
    print(a-1, b)
else:
    print(a, b-1)
S = input()
ans = []

for i in range(len(S)):
    ans.append("x")

print("".join(ans))
d = dict(zip(input().split(), map(int, input().split())))
d[input()] -= 1
print(*d.values())
S, T = input().split()
A,B = map(int,input().split())
U = input()
print(A,B)
if U == S:
  A -= 1
  print(A,B)
else:
  B -= 1
  print(A,B)
s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
  print(a-1,b)
elif s==t:
  print(a,b-1)
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == 'red':
    print(A-1, B)
else:
    print(A, B-1)
list1 = input()
list1 = list1.split(' ')
list2 = input()
list2 = list2.split(' ')
list3 = input()
S = list1[0]
T = list1[1]
lenS = int(list2[0])
lenT = int(list2[1])
select = list3[0]
if select == S:
    lenS -= 1
else:
    lenT -= 1
print(lenS,lenT)
s,t = input().split()
a,b = list(map(int, input().split()))
u = input()

if u == s:
    print(a, b)
else:
    print(a, b-1)
a = list(input())
n = len(a)
for i in range(n):
  a[i] = "x"
l = "".join(a)
print(l)
import sys
input = sys.stdin.readline

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)
S, T = input().split()
A, B = map(int, input().split())
U = input()
print((A-1, B) if S==U else (A, B-1))
s = input().split()
i = list(map(int, input().split()))
a=input()
if a==s[0]:
  i[0]-=1
elif a==s[1]:
  i[1]-=1
print(i)
s,t = input().split()
a,b = map(int,input().split())
u = input()
if u == "red":
    print(a-1,b)
else:
    print(a,b-1)
import sys
input = sys.stdin.buffer.readline
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

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

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


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    d = collections.defaultdict(int)
    st = list(map(str, str(input().rstrip('\n')).split()))
    ab = list(map(str, str(input().rstrip('\n')).split()))
    for s, v in zip(st, ab):
        d[s] = int(v)
    d[str(input().rstrip('\n'))] -= 1
    print(*d.values())


if __name__ == '__main__':
    solve()
S, T = input().split()
A, B = map(int, input().split())
U = input()
C = 0
if S == U:
    C = A - 1
elif T == U:
    C = B - 1
else:
    A = A

print(C)
a,b = map(str, input().split())
c,d = map(int, input().split())
e = input()
if a == e:
  c -= 1
else:
  d -= 1
print(a,b)
S,T=input().split(' ')
A,B=map(int,input().split(' '))
print(A+B-1)
S = input()

l = len(S)
K = ""
for i in range(l):
  K += "x"
  
print(K)
import sys
readline = sys.stdin.readline
s, t = readline().split()
a, b = list(map(int, readline().split()))
if s == readline():
  print(a-1,b)
else:
  print(a,b-1)
color = input()

kosuu = input()

trashc = input()

_ = 0

color = color.split()
kosuu = kosuu.split()
trashc = trashc.split()


while True:
  if(trashc[0] == color[_]):
    if(int(kosuu[_]) > 0):
    	answer = int(kosuu[_]) -1
    	break
    else:
      answer = 0
      break
      
  _= _+1
    
print(answer)
s, t = input().split()
a, b = list(map(int, input().split()))
u = input()
if s == u:
  print(a-1, b)
elif s == t:
  print(a, b-1)
N,M = map(str,input().split())
NN,MM = map(int,input().split())
ress = input()
if(ress == N):
  NN = NN-1
elif(ress == M):
  MM == MM-1
print(MM,NN)
S, T = map(str,input().split())
A, B = map(int, input().split())
U = str(input())

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

print(A, B)
# 入力された文字列をすべてxで置き換える

# 文字列の標準入力
s = input()
sLength = len(s)
hoge = []

for i in range(sLength):
    c = s[i]
    c = "x"
    hoge.append(c)

print(''.join(map(str,hoge)))
S,T=input().split()
A,B=map(int,input().split())
U=input()
if U==S:
  print(str(A-1))
else:
  print(str(B-1))
s,t = input().split()
a,b = map(int, input().split())
u = input()

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

print(a,b)
S,T=map(list,input().split())
A,B=map(int,input().split())
U=(input())
if U=="red":
  print(A-1,B)
else:
  print(A,B-1)
S,T = input().split()
A,B = map(int,input().split())
U = input()

if(S==U):
  print(B)
else:
  print(A)
s,t=input().split()
a,b=map(int,input().split())
u=input().split()
if s==u:
  print(str(a-1)+" "+str(b))
else:
  print(str(a)+" "+str(b-1))
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

dict = {S: A, T: B}

dict[U] = dict[U] - 1

values = []
for k, v in dict.items():
    print(v, end=" ")
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))
s,t=input().split()
a,b=map(int,input().split())
u=input()

if u=="red":
    print(a-1,b)
else:
    print(a,b-1)
dic_lst={}
lst_a=input().split()
lst_b=list(map(int,input().split()))
wd=input()
for i in range(2):
    dic_lst[lst_a[i]]=lst_b[i]
if wd in dic_lst.keys():
    dic_lst[wd]-=1
print(*dic_lst.values())
s,t=(str,input().split())
a,b=(int,input().split())
u=str(input())

if s==u:
  print (a-1,b)
elif t==u:
  print(a,b-1)
# 154
 
S, T = input().split()
A, B = map(int, input().split())
U = input()
 
if len(U) == len(S):
    A -= 1
else:
    B -= 1
print(int(A),int(B))
S, T = input().split()
A, B = map(int, input().split())
U = input()

print(A-1, B if S==U else A, B-1)
s, t = map(str, input().split())
a, b = map(int, input().split())
n = input()
if n == a: print(a-1, b)
else: print(a, b-1)
a = input().split()
c, d = map(int, input().split())
e = input()

if (e == a): c -= 1
else: d -= 1

print("{}" "{}" "{}".format(c," ",d))
s, t = input().split()
a, b =map(int, input().split())
x = input()

if x == a:
  print(a - 1, b)
else:
  print(a, b - 1)
S,T=list(input().split())
A,B=list(map(int,input().split()))
U=input()
D={}
D[S]=A
D[T]=B
D[U]-=1
print(*list(D.values()))
s,t = input().split()
a,b = map(int,input().split())
u = input()
print(a,b-1 if u == t else a-1,b)
s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())
x = a-1,b
y = a,b-1
if s==u:
  print(x)
else:
  print(y)
a,b=input().split()
c,d=map(int,input().split())
print(c-1,d if input()==a else c,d-1)
s,t = map(str,input().split())
a,b = map(int,input().split())
u=input()

if s==u:
    print(a-1)

else:
    print(b-1)
s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
    print(a-1)
else:
    print(b-1)
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))
n,t = input().split()
a,b = map(int,input().split())
print(a)
u = input()
if u == n:
    print(a-1,b)
else:
    print(a,b-1)
ST = input()
A, B = map(int, input().split())
U  = input()
S=ST[0]
T=ST[1]


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

print(A,'',B)
S,T=input().split()
A,B=map(int,input().split())
U=input()
print(S, T)
if(U==S):
    print(A-1, B)
else:
    print(A, B-1)
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)
s, t = input().split()
a,b = map(int, input().split())
u = input()
if s == u:
    print(a-1, b)
elif s == t:
    print(a, b-1)
from sys import stdin
lines = stdin.readlines()
 
S, T = map(str, lines[0].split())
A, B = map(int, lines[1].split())
U = lines[2]

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

print(a, b)
S,T=list(input().split())
A,B=list(map(int,input().split()))
U=input()
D=dict()
D[S]=A
D[T]=B
D[U]-=1
print(*list(D.values()))
def main():
    S,T = input().split()
    a,b = map(int,input().split())
    u = input()
    print(a-1,b if S == u else a,b-1)
    return

if __name__ == "__main__":
    main()
input_str = input().split()
input_int = list(map(int, input().split()))
input_line = input()

input_dict = {}

input_dict[input_str[0]] = input_int[0]
input_dict[input_str[1]] = input_int[1]

input_dict[input_line] = input_dict[input_line] - 1

for i in input_dict:
    print(input_dict[i],end=' ')
S, T = input().split()
A, B = [int(i) for i in input().split()]
U = input()
dic = {S: A, T: B}
dic[U] -= 1
print(' '.join(map(str, dic.values())))
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == "red":
    A -= 1
else:
    B -= 1

print(A, B)
n, m = map(str, input().split())
a, b = map(int, input().split())
u = str(input())

if n==u:
  a=a-1
  
if m==u:
  b=b-1

print(n,m)
print(a,b)
print(u)
S, T = input().split()
A, B = input().split()
U = input().split()
S = str(S)
T = str(T)
A = int(A)
B = int(B)
U = str(U)


if U == S:
    print(A-1,B)
else:
    print(A,B-1)
y = input()
x = [int(x) for x in input().split()]
y = input()
if (y == 'red'):
      print(x[0]-1,x[1])
else:
      print(x[0], x[1]-1)
color=input().split()
x,y=map(int,input().split())
color2=input()

if color2==color[0]:
    print(x-1)
else:
    print(y-1)
tmp = input().split()
S = tmp[0]
T = tmp[1]
i = list(map(int, input().split()))
A = i[0]
B = i[1]
U = input()

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

if U == "red":
    A = A - 1
else:
    B = B - 1

print(A, B)
Moji = input().split()
Ball = input().split()
Takahasi = input()

if Moji == Takahasi:
  print(int(Ball[0])-1,int(Ball[1]))
else:
  print(int(Ball[0]),int(Ball[1])-1)
s, t = input().split()
a, b = map(int, input().split())
u = input()

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

print(a, b)
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    st = list(map(str, str(input().rstrip('\n')).split()))
    ab = list(map(str, str(input().rstrip('\n')).split()))
    d = {s: int(v) for s, v in zip(st, ab)}
    d[str(input().rstrip('\n'))] -= 1
    print(*d.values())


if __name__ == '__main__':
    solve()
red,blue=input().split()
a,b=list(map(int,input().split()))
s = input()
if s == "red":
    print(a-1,b)
else:
    print(a,b-1)
colors = list(map(str, input().split()))
print(colors)
numbers = list(map(int, input().split()))
target_color = input() 

for index, color in enumerate(colors):
  if color == target_color:
    numbers[index] = numbers[index] - 1
    
 
for num in numbers:
  print(str(num) + " ", end="")
s,t =map(str,input().split())
a,b =map(int,input().split())
u=input()
if u==s:
    print(a-1)
else:
    print(b-1)
S,T = list(map(str,input().split()))
A,B = list(map(int,input().split()))
U = input()


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

if U == "red":
    A += -1
else:
    B += -1

print(A, B)
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 ==S:
  print(A,B-1)
l = {}
s, t = map(str, input().split())
a, b = map(int, input().split())
l[s] = a
l[t] = b
u = input()
l[u] -= 1
a = list(map(str, l.values()))
print("{} {}".format(a[0], a[1]))
import sys
input = sys.stdin.readline

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

if S==U:
  print(A-1,B)
else:
  print(A,B-1)
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

import numpy as np
def main():
    S,T = input().split()
    A,B = MAP()
    U = input()

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

    return

if __name__ == '__main__':
    main()
s,t = input().split()
a,b = (int(x) for x in input().split())
u = input()

if u==s:
    print(a-1)
elif u==t:
    print(b-1)
S, T = input().split()
A, B = map(int, input().split())
U = input()

if "S"=="U":
    print(A-1, B)
else :
    print(A, B-1)
s, t = input().split()
a, b = map(int, input().split())
c = input()
if c == a: a -= 1
else: b -= 1
print(a, b)
S,T=input().split()
A,B=map(int,input().split())
U=input()

d={S:A,T:B}

d[U]-=1

for i in list(d.values()):
    print(i, end=" ")
tmp = input().split()
S = tmp[0]
T = tmp[1]
i = list(map(int, input().split()))
A = i[0]
B = i[1]
U = input()

if S == U:
  print(str(A-1) + " " + str(B))
else:
  print(str(B) + " " + str(A))
a, b=map(str,input().split())
c, d=map(int,input().split())
e=input()
f=str(e)
if e==f:
  print(c-1,d)
else:
  print(c,d-1)
s,t = (i for i in input().split())
a,b = (int(i) for i in input().split())
u = input()

set = {s:a, t:b}
if u == s: set[s] -= 1
else: set[t] -= 1

for i in set.values(): print(i,end=" ")
print()
target_a, target_b = list(map(str, input().split()))
a, b = map(int, input().split())
target = input('')
list_target_a = list(target_a)
list_target_b = list(target_b)
list_target = list(target)

if len(list_target) == len(list_target_a):
    a -= 1
elif len(list_target) == len(list_target_b):
    b -= 1

print(a, b)
import sys


input = sys.stdin.readline

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

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


resolve()
s,t = (i for i in input().split())
a,b = (int(i) for i in input().split())
u = input()

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

for i in c.values(): print(i,end=" ")
print()
s,t = input().split()
a,b = map(int,input().split())
j = input()
if s == j or t == j:
  print(a+b-1)
else:
  print(a+b)
s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
  print(a-1,b)
elif t==u:
  print(b-1,a)
color = input()

kosuu = input()

trashc = input()

_ = 0

color = color.split()
kosuu = kosuu.split()
trashc = trashc.split()


while True:
  if(trashc[0] == color[_]):
    kosuu[_] = int(kosuu[_]) -1
    break
      
  _= _+1
    
print(kosuu)
s, t = input().split()
a, b = map(int, input().split())
u=input()

if(u==s):
  print(a-1)
else:
 print(b-1)
red, blue= input().split()
r, b = [int (x) for x in input().split()]
s = input()
if s == "red":
    r = r - 1
else:
    b = b - 1
print(r, end=" ")
print(b)
s,t=map(str,input().split())
a,b=map(int,input().split())
q=input()
print(a-1,b if q==s else a,b-1)
balls_color = input().split()
balls_count = map(int, input().split())

balls = dict(zip(balls_color, balls_count))
trash = input()

balls[trash] -= 1

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

N_dict[str(input())] -= 1
print(" ".join(list(map(str,N_dict.values()))))
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

dict = {S: A, T: B}

dict[U] = dict[U] - 1

values = []
for k, v in dict.items():
    print(v, end="")
import numpy

S, T = map(str, input().split())
AB = list(map(int, input().split()))
U = input()

if U == S:
    tmp = numpy.array([1,0])
else:
    tmp = numpy.array([0,1])
print(numpy.array(AB-tmp))
ball = input().split()
number = list(map(int, input().split()))
U = input()

if U == ball[0]:
    number[0] -= 1
else:
    number[1] -= 1
print(number)
s, t = input().split()
a,b = map(int,input().split())
u = input().split()

if s == u:
	print(a-1)

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

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

values = []
for k, v in dict.items():
    values.append(v)

print(' '.join(map(str, values)))
n,t = input().split()
a,b = map(int,input().split())
print(a)
u = input()
if u == n:
    print(a-1)
else:
    print(b-1)
S, T = input().split()
A, B = map(int,input().split())
U = input()

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

dic[U] -= 1

for key in dic.keys():
    print(str(dic[key])+' ',end='')
def resolve():
    import sys
    input = sys.stdin.readline
    
    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__":
    resolve()
S, T= input().split()
A, B= map(int, input().split())
U= input().split()
 

if (S==U):
    
    print(A-1,B)
elif (T==U):
    print(A,B-1)
else:
    print(A,B)
S,T=map(str,input().split())
A,B=map(int,input().split())
U=str(input())
if S==T:
  print(A-1)
  print(B)
else:
  print(A)
  print(B-1)
s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == "red":
    print(int(a-1),b)
else:
    print(a,int(b-1))
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))
else:print(str(a) + ' ' + str(b))
ball1,ball2=map(str,input().split())
c1,c2=map(int,input().split())
x=input()
print(c1-1,c2 if x==ball1 else c1,c2-1)
S,T=input().split()
A,B=map(int,input().split())
U=input()
ST={S:A,T:B}
ST[U]-=1
print(*list(ST.values()))
s,t=input().split()
a,b=map(int,input().split())
u  =input()
if s==u:
	print(a-1)
else:
	print(b-1)
s,t,a,b,u=open(0).read().split()
if s==u:
    print(int(a)-1)
elif t==u:
    print(int(b)-1)
S, T = input().split()
A, B = input().split()
U = input()

print("{} {}".format(int(A) - 1 if S == U else 0, int(B) - 1 if T == U else 0))
name  = list(map(str, input().split()))
number=list(map(int, input().split()))
dash  =input()
if name[0] == dash:
   number[0]=number[0]-1
print(number[0],number[1])
S, T = input().split()
s, t = map(int, input().split())
U = input()
dic = {S:s, T:t}
dic[U] -= 1
print([num for num in dic.values()])
s,t=input().split()
a,b=input().split()
a=int(a)
b=int(b)
u=input()
dict={}
dict[s]=a
dict[t]=b

dict[u]-=1

for k,v in dict.items():
    print(v,end=' ')
s,t=input().split()
a,b=map(int,input().split())
u=input()
if u=='red':
    print(a-1,b)
else:
    print(a,b-1)
dic = {}
for i, j in zip(input().split(), list(map(int, input().split()))):
  dic[i] = j
dic[input()] -= 1
print(*dic.values())
S, T = input().split()
A, B = input().split()
U = input()

if(U == 'blue'):
    B = int(B) - 1
else:
    A = int(A) - 1
print(str(A) + ' ' + str(B))
s,t = input().split()
a,b = map(int,input().split())
u = input()
if u == 'red':
  print(a-1,b)
else:
  print(a,b-1)
s,t = map(str,input().split())
a,b = map(int,input().split())
u =map(str,input().split())

if s==u:
  a -=1
else:
  b -=1
  
print(a,b)
def func():
    colors = input("Color: ").split()
    numbers = list(map(int, input("Number: ").split()))
    picked_color = input("Pick: ")
    
    dic = dict(zip(colors, numbers))
    ans = list()
    for color, number in dic.items():
        if color == picked_color:
            number -= 1
        ans.append(number)

    return ' '.join(str(n) for n in ans)
import sys
input = sys.stdin.buffer.readline
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

s, t = input().split()
ab = LIST()
u = input()

if u == s:
    ab[0] -= 1
if u == t:
    ab[1] -= 1
    
ab = [str(i) for i in ab]
print(' '.join(ab))
fs, bs = map(str,input().split())
ci, di = map(int,input().split())
es = str(input())

if es == fs:
  ca = ci - 1
  print(ca,di)
elif es == bs:
  da = di -1
  print(da,ci)
color = input().split() #s_1 s_2を分割して取得し、sに値を入れる
count = list(map(int, input().split())) #i_1 i_2を取得し、iに値を入れる
select_color = input() # 玉の色を選択

for i in range(0, 1):
    if select_color == color[i]:
        count[i] -= 1
print(count[0], count[1]) #残りの個数を出力
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

balls = {s:a, t:b}

for key in balls:
    if key == u:
        balls[key] = balls[key] - 1

listBalls = list(balls.values())
print('{} {}'.format(listBalls[0], listBalls[1]))
s,t=input().split()
a,b=map(int,input().split())
u=input()
if u=="red":
    print(a-1,b)
else:
    print(a,b-1)
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)
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))
S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == "red":
    print(A-1,B)
else:
    print(A,B-1)
a, b = input().split()
na, nb = map(int, input().split())
c = input()
print(na - 1, nb if c == "red" else na, nb - 1)
S = len(input())
cnt = "x"
length = 0
a = "x"
while S != length:
    cnt = cnt + a
    length = len(cnt)
print(cnt)