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

void main(){

    while(true){
	int h,w;
	string[] map;
	auto s = readln().split().to!(int[]);
	h = s[0];
	w = s[1];
	if(h==0&&w==0) break;
	for(int i=0;i<h;i++){
	    map ~= readln().chomp();
	}
	int x,y;
	int[101][101] used;
	while(true){
	    used[y][x] = true;
	    if(map[y][x] == '>') x++;
	    else if(map[y][x] == '<') x--;
	    else if(map[y][x] == '^') y--;
	    else if(map[y][x] == 'v') y++;
	    else if(map[y][x] == '.') {
		writeln(x," ",y);
		break;
	    }
	    if(used[y][x]){
		writeln("LOOP");
	    	break;
	    }
	}
    }
}