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