#include <iostream>
#include <string>
using namespace std;
int loop_counter[100][100]={0};
string board[100];
int loop(int y,int x ){
	loop_counter[y][x]++;
	if(loop_counter[y][x]>=2)
		cout<<"LOOP"<<endl;
	else if(board[y][x]=='^')
		return loop(y-1,x);
	else if(board[y][x]=='v')
		return loop(y+1,x);
	else if(board[y][x]=='<')
		return loop(y,x-1);
	else if(board[y][x]=='>')
		return loop(y,x+1);
	else if(board[y][x]=='.')
		cout << x <<" "<<y<<endl;
	return 0;
}
int main(){
	int h,w;
	while(cin >> h >> w){
		if(h==0 && w==0)
			return 0;
		for(int i=0 ; i<h ; i++ )
			cin >> board[i];
		loop(0,0);
	}
}