def solve(h, w, b)
    x, y = 0, 0
    loop.with_index do |_, i|
        if i == h * w
            puts "LOOP"
            break
        end
        case b[y][x]
            when '>' then
                x += 1
            when '<' then
                x -= 1
            when 'v' then
                y += 1
            when '^' then
                y -= 1
            when '.' then
                puts "#{x} #{y}"
                return
        end
    end
end

loop do
    h, w = gets.chomp.split(' ').map(&:to_i)
    break if h == 0 && w == 0
    b = h.times.collect do
        gets.chomp.split('')
    end
    solve(h, w, b)
end