class Tiles
  def initialize
    @tiles = []
  end

  def add(row)
    x, y = -1, @tiles.length
    @tiles << row.map{|item|
      x += 1
      Tile.new(x, y, item)
    }
  end

  def set
    @tiles.each{|row|
      row.each{|item|
        x, y = item.next_ord
        item.set_parent(@tiles[y][x])
      }
    }
  end

  def solve
    normal, twice = @tiles[0][0].next, @tiles[0][0].next.next
    while normal != twice
      normal, twice = normal.next, twice.next.next
    end
    if normal.tip?
      puts normal.to_s
    else
      puts "LOOP"
    end
  end

end

class Tile
  attr_reader :x, :y
  @@condition = {">" => 5, "<" => 3, "^" => 1, "v"=> 7, "." => 4}
  def initialize(x, y, arrow)
    @x = x
    @y = y
    @parent = nil
    @condition = @@condition[arrow]
  end
  
  def set_parent(other)
    @parent = other
  end

  def ==(other)
    return ((@x == other.x) and (@y == other.y))
  end

  def next_ord
    return x + ((@condition % 3) <=> 1), y + ((@condition / 3) <=> 1)
  end

  def next
    return @parent
  end

  def tip?
    return @condition == 4
  end

  def to_s
    return "#{x} #{y}"
  end

  def inspect
    to_s
  end
  
  
end
def main
  while (h, w = gets.split(" ").map(&:to_i)) != [0, 0] # !> assigned but unused variable - w
    tiles = Tiles.new
    h.times do
      tiles.add(gets.chomp.split(""))
    end
    tiles.set
    tiles.solve
  end
end
main