import std.stdio, std.conv, std.algorithm, std.array, std.string;

void main() {
	string[] result;
	while (true) {
		auto tmp = readln.split.map!(to!int).array;	
		auto w = tmp[1], h = tmp[0];
		if (w == 0 && h == 0) break;
		struct Point {
			int dx, dy;
			bool flag;
		}
		Point[][] cell = new Point[][](w, h);
		foreach (y; 0..h) {
			auto str = readln;
			foreach (x; 0..w) {
				if (str[x] == '>') {
					cell[x][y] = Point(+1, 0);	
				} else if (str[x] == '<') {
					cell[x][y] = Point(-1, 0);	
				} else if (str[x] == 'v') {
					cell[x][y] = Point(0, +1);	
				} else if (str[x] == '^'){
					cell[x][y] = Point(0, -1);	
				} else {
					cell[x][y] = Point(0, 0);
				}
			}
		}
		uint cx = 0, cy = 0;
		while (true) {
			auto c = cell[cx][cy];
			if (c.flag) {
				result ~= "LOOP";
				break;
			} 
			if (c.dx == 0 && c.dy == 0) {
				result ~= cx.to!string ~ " " ~ cy.to!string;
				break;
			}
			cell[cx][cy].flag = true;
			cx += c.dx;
			cy += c.dy;
		}
	}	
	foreach (r; result) r.writeln;
}