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

void main(){
    char[101][101] map;
    while(true){
        int w,h;
        readf("%d %d\n",&h,&w);
        if(!w&&!h)break;
        bool[102*102*102] memo;
        foreach(y;0..h){
            map[y][0..w]=readln[0..w];
        }
        int x,y;
        loop:while(1){
            if(memo[y*102+x]){
                "LOOP".writeln;
                break;
            }
            memo[y*102+x]=true;
            final switch(map[y][x]){
                case '>':++x;break;
                case '<':--x;break;
                case 'v':++y;break;
                case '^':--y;break;
                case '.':
                    writeln(x," ",y);
                    break loop;
            } 
        }
    }
}