/*****include*****/
#include <iostream>
#include <fstream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return 0;
	}
#endif
	/*****変数置き場*****/
	char (**field);
	bool (**appear);
	char *buff;
	int height;
	int width;
	int x_ax,y_ax;
	/*****処理部*****/
	while(1){
		cin >> height >> width;
		if(height == 0 && width == 0)	break;
		field = new char* [height];
		appear = new bool* [height];
		buff = new char [height];
		for(int i=0;i<height;i++){
			field[i] = new char [width];
			appear[i] = new bool [width];
		}
		for(int i=0;i<height;i++){
			cin >> buff;
			for(int j=0;j<width;j++)
				field[i][j] = buff[j];
		}
		for(int i=0;i<height;i++)
			for(int j=0;j<height;j++)
				appear[i][j] = false;
		x_ax = 0;y_ax = 0;
		while(1){
			if(field[y_ax][x_ax] == '>'){
				x_ax++;
				if(appear[y_ax][x_ax]){
					cout << "LOOP" << endl;
					break;
				}
				appear[y_ax][x_ax] = true;
			}else if(field[y_ax][x_ax] == '<'){
				x_ax--;
				if(appear[y_ax][x_ax]){
					cout << "LOOP" << endl;
					break;
				}
				appear[y_ax][x_ax] = true;
			}else if(field[y_ax][x_ax] == 'v'){
				y_ax++;
				if(appear[y_ax][x_ax]){
					cout << "LOOP" << endl;
					break;
				}
				appear[y_ax][x_ax] = true;
			}else if(field[y_ax][x_ax] == '^'){
				y_ax--;
				if(appear[y_ax][x_ax]){
					cout << "LOOP" << endl;
					break;
				}
				appear[y_ax][x_ax] = true;
			}else if(field[y_ax][x_ax] == '.'){
				cout << x_ax << " " << y_ax << endl;
				break;
			}else{
				cout << "ERROR" << endl;
				break;
			}
		}
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}