#include <iostream>
using namespace std;

int main(){
	int h, w, i, j;
	while(cin >> h >> w, h != 0 or w != 0){
		int root[h][w];
		char tile[h][w];
		for(i = 0; i < h; i++){
			for(j = 0; j < w; j++){
				root[i][j] = 0;
			}
		}
		for(i = 0; i < h; i++){
			for(j = 0; j < w; j++){
				cin >> tile[i][j];
			}
		}
		
		i = 0;
		j = 0;
		while(tile[i][j] != '.'){
			if(root[i][j] != 0){
				cout << "LOOP" << endl;
				break;
			}
			root[i][j]++;
			switch(tile[i][j]){
				case '>':
					j++;
					break;
				case '<':
					j--;
					break;
				case 'v':
					i++;
					break;
				case '^':
					i--;
					break;
			}
		}
		if(tile[i][j] == '.') cout << j << ' ' << i << endl;
	}
	return 0;
}