def onTile tile, x, y
  (0 <= x && x < tile[0].length) && (0 <= y && y < tile.length)
end

def onArrow tile, x, y
  tile[y][x] == ">" || tile[y][x] == "<" || tile[y][x] == "^" || tile[y][x] == "v"
end

def createTile width, height
  tile = Array.new
  height.times do
    tile << $stdin.gets.chomp.split("")
  end
  tile
end

def solve tile, x, y
  visited = Array.new(tile.length).map{Array.new(tile[0].length, false)}
  while (onTile(tile, x, y) && !visited[y][x] && onArrow(tile, x, y)) do
    visited[y][x] = true
    case tile[y][x]
    when ">" then
      x += 1
    when "v" then
      y += 1
    when "<" then
      x -= 1
    when "^" then
      y -= 1
    else
      #do nothing
    end
  end
  visited[y][x] ? "LOOP" : (x.to_s + " " + y.to_s)
end

height, width = $stdin.gets.chomp.split(" ").map(&:to_i)
while width > 0 && height > 0 do
  puts solve(createTile(width, height), 0, 0)
  height, width = $stdin.gets.chomp.split(" ").map(&:to_i)
end