import scala.io.StdIn._
import scala.util.control.Breaks

object Main extends App {
  val blk = new Breaks

  blk.breakable {
    while (true) {
      val Seq(h, w) = readLine.split(' ').map(_.toInt).toList
      if (h == 0 && w == 0) blk.break()

      val arr = new Array[Array[Char]](h)

      for (i <- 0 until h) {
        arr(i) = readLine.toCharArray
      }

      var x = 0
      var y = 0

      while (arr(y)(x) != '.' && arr(y)(x) != 'X') {
        val tile = arr(y)(x)
        arr(y)(x) = 'X'

        tile match {
          case '>' => x += 1
          case 'v' => y += 1
          case '<' => x -= 1
          case '^' => y -= 1
        }
      }
      if (arr(y)(x) == '.') println("%d %d".format(x, y)) else println("LOOP")
    }
  }
}
