#include<cstdio>
#include<iostream>
  
using namespace std;
  
int main(void){

	int W,H;
	int x,y;
	bool f;
	char stage[101][101];

	while(1){
		cin>>H>>W;
		if(H==0&&W==0) break;
		getchar();
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				stage[i][j]=getchar();
			}
			getchar();
		}
		x=0,y=0;
		f=true;
		while(f){
			switch(stage[y][x]){
				case '>':
					stage[y][x]='-';
					x+=1;
					break;
				case '<':
					stage[y][x]='-';
					x-=1;
					break;
				case '^':
					stage[y][x]='-';
					y-=1;
					break;
				case 'v':
					stage[y][x]='-';
					y+=1;
					break;
				case '.':
					cout<<x<<" "<<y<<endl;
					f=false;
					break;
				case '-':
					cout<<"LOOP"<<endl;
					f=false;
					break;
				default:
					cout<<"error"<<endl;
					return -1;
			}
		}
	}

	return 0;
}