import scala.io.StdIn.readLine
import scala.collection.mutable.ArrayBuffer

object Main extends App {
  val b = new ArrayBuffer[String]
  var l = "0 0"
  while({l= readLine.trim;l} != "0 0") {
    val size = l.split(" ").map(_.toInt)
    val matrix = (0 until size(0)).map(_=>readLine.trim.toArray)
    var (x,y,count) = (0,0,0)
    while(matrix(y)(x)!='.' && count<=size(0)*size(1)) {
      val c = matrix(y)(x)
      if(c=='>') x+=1
      else if(c=='v') y+=1
      else if(c=='^') y-=1
      else if(c=='<') x-=1
      count += 1
    }
    if(count<=size(0)*size(1))
      b += x + " " + y
    else
      b += "LOOP"
  }
  println(b.mkString("\n"))
}