a,*s=open(0) w=len(s[0]) s="".join(s) I=s.find('R') while 1:s[N:=(I+2+~-w*(I%w'A'else print(I//w+1,I%w+1));I=N