import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	while (1) {
		auto a = readln.split.map!(to!int);
		auto h = a[0];
		auto w = a[1];
		if (!h) break;
		auto field = new string[](h);
		auto f = new bool[][](h, w);

		foreach (i; 0..h) {
			field[i] = readln.chomp;
		}

		uint x, y;
		while (1) {
			if (f[y][x]) {
				writeln("LOOP");
				break;
			}
			f[y][x] = 1;
			if (field[y][x] == '.') {
				writeln(x, " ", y);
				break;
			} else if (field[y][x] == '>') {
				x++;	
			} else if (field[y][x] == '<') {
				x--;	
			} else if (field[y][x] == 'v') {
				y++;	
			} else if (field[y][x] == '^') {
				y--;	
			}
		}
	}
}