#include <bits/stdc++.h>
using namespace std;
int a,b;

int main() {
while(cin>>a>>b){
if(a==0&&b==0){break;}
string data[a];
int b[a][b]={0};
for (int i = 0; i < a; ++i) {
	cin>>data[i];
}
int H=0,W=0;
int loop=0;
while(1){
if (data[H][W]=='<') {
b[H][W]=1;
W-=1;
if(b[H][W]==1){loop=1;break;}

} else if (data[H][W]=='>')  {
b[H][W]=1;
W+=1;
if(b[H][W]==1){loop=1;break;}
} else if (data[H][W]=='v')  {
	b[H][W]=1;
	H+=1;
if(b[H][W]==1){loop=1;break;}
} else if (data[H][W]=='^')  {
	b[H][W]=1;
	H-=1;
if(b[H][W]==1){loop=1;break;}
}else{
break;
}
}
if(loop==1){cout<<"LOOP"<<endl;}
else{cout<<W<<" "<<H<<endl;}
}
return 0;
}