$check
$fie = []
def solve(x,y)
#  print x," ",y," ",$check[x][y],"\n"
  return -1,-1 if $check[x][y]==1
  $check[x][y]=1
  return solve(x+1,y) if $fie[y][x]=='>'
  return solve(x-1,y) if $fie[y][x]=='<'
  return solve(x,y-1) if $fie[y][x]=='^'
  return solve(x,y+1) if $fie[y][x]=='v'
  return x,y if $fie[y][x]=='.'
  return -1,-1
end

while true do
  wh = gets.split()
  h=wh[0].to_i
  w=wh[1].to_i
  break if w==0 && h==0
  for i in 0...h do
    $fie[i]=gets.chop
  end
  $check = Array.new(102).map!{ Array.new( 102, 0) }
  res=solve(0,0)
  if res[0]==-1 && res[1]==-1  then
    print "LOOP\n"
  else
    print res[0]," ",res[1],"\n"
  end
end