s,a,u=open(0);i=u in s;print((int(a[:2])-1+i,int(a[2:])-i))
s,a,u=open(0)

*a,=list(map(int,a.split()))

a[u in s]-=1

print((*a))
s, a, u = open(0)
i = u in s
print((int(a[:2]) - 1 + i, int(a[2:]) - i))

s, a, u = open(0)
(*a,) = list(map(int, a.split()))
a[u in s] -= 1
print((*a))

-i = u in s -print((int(a[:2]) - 1 + i, int(a[2:]) - i)) +(*a,) = list(map(int, a.split())) +a[u in s] -= 1 +print((*a))