s,a,u=open(0)

i=s.find(u)<1

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

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

-i = s.find(u) < 1 -print((int(a[:2]) - i, int(a[2:]) - 1 + i)) +i = u in s +print((int(a[:2]) - 1 + i, int(a[2:]) - i))