require 'scanf'
while true
    height,width = STDIN.gets.scanf("%d %d")
    exit 0 if width==0 and height==0
    
    data=Array.new(height)
    for h in 0..height-1 do; data[h]=Array[width]; end

    for h in 0..height-1 do
        str = STDIN.gets.chomp
        for w in 0..width-1 do
            data[h][w] = str[w]
        end
    end

    x,y=0,0
    list = Array.new
    while true
        if data[y][x]=='.' then
            print x," ",y,"\n"
            break
        end
        if list.include?([x,y]) then
            print "LOOP\n" 
            break
        end

        list.push([x,y])
        x = x+1 if data[y][x]==">"
        x = x-1 if data[y][x]=="<"
        y = y+1 if data[y][x]=="v"
        y = y-1 if data[y][x]=="^"
    end
end