loop do
	h, w = $<.gets.split.map(&:to_i)
	break if w.zero? and h.zero?

	tile = h.times.map{$<.gets.chomp}

	y = x = 0
	route = []
	loop do
		if route.include?([x, y])
			puts 'LOOP'
			break
		end
		route << [x, y]

		case tile[y][x]
		when '^'; y -= 1
		when 'v'; y += 1
		when '>'; x += 1
		when '<'; x -= 1
		else
			puts "#{x} #{y}"
			break
		end
	end
end