if true then
  fh=STDIN
else
  fh=open("in0104.txt")
end

while true
  h,w=fh.gets.chomp.split.map{|x| x.to_i}
  break if h==0 and w==0

  fvisit = Array.new(h).map{|i| Array.new(w,false)}
  tl = []

  0.upto(h-1){|i|
    f=fh.gets.chomp.split(//)
    abort("w data strange") if f.length != w
    tl.push(f)
  }
  abort("h data strange") if tl.length != h

  x = 0
  y = 0
  while true
    if not fvisit[y][x] then
      fvisit[y][x] = true
    else
      st = "LOOP"
      break
    end
    case tl[y][x]
    when '>' then
      x += 1
    when '<' then
      x -= 1
    when '^' then
      y -= 1
    when 'v' then
      y += 1
    else
      st="STOP"
      break
    end
    abort("OUT") if x<0 or x>w-1 or y<0 or y>h-1
  end

  if st=="LOOP" then
    puts "LOOP"
  elsif st=="STOP" then
    puts "#{x} #{y}"
  else
    abort("Unknown")
  end
end