($h,$w)=glob<>;$x?($c=vec$_,++$x%$w,8)&4||last:/R/?$x="@- ":0,$y++for(<>)x2e3;print$c&1?($y%$h||$h,$",$x%$w||$w):loop