while input_lines = gets.chomp
    break if input_lines == "0 0"
    tiles_depth, tiles_width = input_lines.split(' ').map!(&:to_i)

    tiles_arr = []
    tiles_move_cache = []
    tiles_depth.times do
        tiles_arr << gets.chomp.split('')

        tiles_cache_temp = []
        tiles_width.times do
            tiles_cache_temp << 0
        end
        tiles_move_cache << tiles_cache_temp
    end

    x_point = 0
    y_point = 0
    loop do
        if tiles_move_cache[y_point][x_point] == 0
            tiles_move_cache[y_point][x_point] = 1
        else
            puts "LOOP"
            break
        end

        case tiles_arr[y_point][x_point]
        when ">"
            x_point += 1
        when "<"
            x_point -= 1
        when "^"
            y_point -= 1
        when "v"
            y_point += 1
        when "."
            puts "#{x_point} #{y_point}"
            break
        end
    end
end