a,*s=open(0) w=len(s[0]) s="".join(s) I=s.find('R') while 1:s[N:=(I-~(I%w>w-3or w))%len(s)]!='.'>exit(print([f"{I//w+1} {I%w+1}","loop"][a