#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int loop_counter[100][100]={0};
string board[100];
int loop(int y,int x){

	if(loop_counter[y][x]){
		cout<<"LOOP"<<endl;
		return 0;
	}
	loop_counter[y][x]=1;
	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;
	}
	return 0;
}
int main(){
	int h,w;
	while(1){
		cin >> h >> w;
		if(h==0 && w==0)
			return 0;
		for(int i=0 ; i<h ; i++ )
			cin >> board[i];
		loop(0,0);
	}
}