module AOJ_Volume0104;

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

int main()
{
	string f[101];
	while(true)
	{
		string[] s = readln.chomp.split(" ");
		int n = s[0].to!int;
		int m = s[1].to!int;

		if(n == 0 && m == 0) break;

		foreach(i;0..n)
		{
			f[i] = readln.chomp;
		}

		int memo[101][101];
		foreach(i;0..101)
		{
			foreach(j;0..101)
			{
				memo[i][j] = 0;
			}
		}

		int i=0,j=0;
		while(f[i][j] != '.' && memo[i][j] == 0)
		{
			memo[i][j]++;

			if(f[i][j] == '>')
			{
				j++;
			}
			else if(f[i][j] == '<')
			{
				j--;
			}
			else if(f[i][j] == 'v')
			{
				i++;
			}
			else if(f[i][j] == '^')
			{
				i--;
			}
		}

		if(memo[i][j] == 0)
		{
			writeln(j," ",i);
		}
		else
		{
			"LOOP".writeln;
		}
	}
	return 0;
}