loop do
  map = []
  x, y, c = 0, 0, 0
  h, m = gets.split.map(&:to_i)
  break if h == 0 && m == 0
  
  h.times do
    t = []
    gets.chomp.chars {|c| t << c}
    map << t
  end
  
  while c < h * m
    case map[y][x]
    when '>'
      x += 1
    when '<'
      x -= 1
    when '^'
      y -= 1
    when 'v'
      y += 1
    else
      break
    end
    c += 1
  end

  puts c < h * m ? "#{x} #{y}" : 'LOOP'
end