_,*s=open(0) w=len(G[0]) s=''.join(s) k=s.find('R') for _ in s:i=k//w+1;j=k%w+1;'#'==s[k:=i%len(s)*w+j%~-w]>exit(print(i,j)) print('loop')