#include<iostream>
#include<string>
using namespace std;
int main() {
	string date[111];
	int a, b;
	int x, y,loop;
	int date2[111][111];
	while (1) {
		loop = 0;
		for (int i = 0; i <= 101; i++) {
			for (int z = 0; z <= 101; z++) {
				date2[i][z] = 0;
			}
		}
		cin >> a >> b;
		if (a == 0 && b == 0) {
			goto end;
		}
		for (int i = 0; i < a; i++) {
			cin >> date[i];
		}
		x = 0;
		y = 0;
		while (1) {
			if (date[y][x] == '>') {
				if (date2[y][x] == 1) {
					goto b;
				}
				date2[y][x] = 1;
				x = x + 1;
			}
			if (date[y][x] == '<') {
				if (date2[y][x] == 1) {
					goto b;
				}
				date2[y][x] = 1;
				x = x - 1;
			}
			if (date[y][x] == 'v') {
				if (date2[y][x] == 1) {
					goto b;
				}
				date2[y][x] = 1;
				y = y + 1;
			}
			if (date[y][x] == '^') {
				if (date2[y][x] == 1) {
					goto b;
				}
				date2[y][x] = 1;
				y = y - 1;
			}
			if (date[y][x] == '.') {
				goto a;
			}
		}
		b:;
		loop = 1;
		a:;
		if (loop == 1) {
			cout << "LOOP" << endl;
		}
		else {
			cout << x << " " << y << endl;
		}
	}
end:;
}
