Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		l := strings.Split(stdin.Text(), " ")
		if l[0] == "0" {
			break
		}
		h, _ := strconv.Atoi(l[0])
		w, _ := strconv.Atoi(l[1])

		tile := make([][]rune, h)
		done := make([][]bool, h)
		for i := 0; i < h; i++ {
			stdin.Scan()
			s := stdin.Text()
			tile[i] = make([]rune, w)
			done[i] = make([]bool, w)
			for j, c := range s {
				tile[i][j] = c
			}
		}
		i, j := 0, 0
		for tile[i][j] != '.' {
			if done[i][j] {
				i = -1
				break
			}
			done[i][j] = true
			switch tile[i][j] {
			case '>':
				j++
			case '<':
				j--
			case '^':
				i--
			case 'v':
				i++
			}
		}
		if i < 0 {
			fmt.Println("LOOP")
		} else {
			fmt.Println(j, i)
		}
	}
}

Python: # coding=utf-8

###
### for python program
###

import sys
import math

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    def pnum_check(self, n):
        if (n==1):
            return False
        elif (n==2):
            return True
        else:
            for x in range(2,n):
                if(n % x==0):
                    return False
            return True

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
# print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
# print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
# print(" {}".format(i), end="")

# def printA(A):
#     for i, n in enumerate(A):
#         print(n, end='')
#         if i != N-1:
#             print(' ', end='')
#     print()

# リスト内包表記 ifあり
# [x-k if x != 0 else x for x in C]

# ソート
# N = N.sort()

# 10000個の素数リスト
# P = mymath.pnum_eratosthenes(105000)

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

def dist(A, B):
    d = 0
    for i in range(len(A)):
        d += (A[i]-B[i])**2            
    d = d**(1/2)
    return d

def get_input():
    N = []
    while True:
        try:
            N.append(input())
            #N.append(int(input()))
            #N.append(float(input()))
        except EOFError:
            break
    return N

while True:
    H, W = [int(x) for x in input().split()]
    if H==0 and W==0:
        break
    M = []
    for i in range(H):
        M.append(input())

    root = []
    x = 0
    y = 0
    while True:
        if M[y][x] == '>':
            x += 1
        elif M[y][x] == '<':
            x -= 1
        elif M[y][x] == 'v':
            y += 1
        elif M[y][x] == '^':
            y -= 1
        
        if M[y][x] == '.':
            print(x,y,sep=' ')
            break
        
        if (x,y) in root:
            print("LOOP")
            break
        
        root.append((x,y))

Python: size = input()#Y???X????????????????????¨?????¨???
while size != '0 0':
	tile = []
	for i in range(0, int(size.split(' ')[0])):#?????????????????????
		tilestr = []
		inp = input()
		for j in range(0,int(size.split(' ')[1])):
				 tilestr.append(inp[j:j+1])
		tile.append(tilestr)
		isVisited = []
		for i in range(0 , len(tile)):
			isIdxVisited = []
			for j in range(0,len(tile[i])):
				isIdxVisited.append(False)
			isVisited.append(isIdxVisited)
	currentIdx = [0,0] #?????£??????XY??§?¨?
	while True:
		if isVisited[currentIdx[1]][currentIdx[0]] == True:#???????????¨[Y][X]???????????????
			print('LOOP')
			break
		isVisited[currentIdx[1]][currentIdx[0]] = True
		if tile[currentIdx[1]][currentIdx[0]] == '^':
			currentIdx[1] -= 1
			continue
		elif tile[currentIdx[1]][currentIdx[0]] == 'v':
			currentIdx[1] += 1
			continue
		elif tile[currentIdx[1]][currentIdx[0]] == '<':
			currentIdx[0] -= 1
			continue
		elif tile[currentIdx[1]][currentIdx[0]] == '>':
			currentIdx[0] += 1
			continue
		elif tile[currentIdx[1]][currentIdx[0]] == '.':
			print(str(currentIdx[0])+' '+str(currentIdx[1]))
			break
	size = input()

Python: def magicall(tiles,a,b):
    point = tiles[a][b]
    if point==".":return a,b
    elif point==">":tiles[a][b] = "0";return magicall(tiles,a,b+1)
    elif point=="<":tiles[a][b] = "0";return magicall(tiles,a,b-1)
    elif point=="^":tiles[a][b] = "0";return magicall(tiles,a-1,b)
    elif point=="v":tiles[a][b] = "0";return magicall(tiles,a+1,b)
    elif point=="0":return "LOOP"

while 1:
    H,W=map(int,input().split())
    if H==0:break
    tilis=[list(input()) for i in range(H)]
    answer = magicall(tilis,0,0)
    if type(answer)==tuple:
        print(answer[1],answer[0])
    else:print(answer)

Python: def run_magic_tiles(magic_tiles, past_matrix):
    i, j = 0, 0
    while True:
        move = {
            '^': (-1, 0),
            'v': (1, 0),
            '<': (0, -1),
            '>': (0, 1),
            '.': (-1, -1)
        }.get(magic_tiles[i][j])
        if move[0] == -1 and move[1] == -1:
            return j, i
        else:
            i += move[0]
            j += move[1]
            if past_matrix[i][j]:
                return 'LOOP'
            past_matrix[i][j] = 1


def main():
    while True:
        c, r = map(int, input().split(' '))
        if c == 0 and r == 0:
            break

        past_matrix = [[0 for _ in range(r)] for _ in range(c)]
        tiles = []
        for _ in range(c):
            tiles.append(list(input()))

        res = run_magic_tiles(tiles, past_matrix)
        print('LOOP' if res == 'LOOP' else '%d %d' % (res[0], res[1]))


if __name__ == '__main__':
    main()

Python: # Aizu Problem 0104: Magical Tiles
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def magical_tiles(H, W, tiles):
    moves = {'>': [0, 1], '<': [0, -1], '^': [-1, 0], 'v': [1, 0]}
    visited = set()
    row, col = 0, 0
    while True:
        if tiles[row][col] == '.':
            print(col, row)
            return
        if (row, col) in visited:
            print("LOOP")
            return
        visited.add((row, col))
        direction = tiles[row][col]
        row += moves[direction][0]
        col += moves[direction][1]
    
while True:
    H, W = [int(_) for _ in input().split()]
    if H == W == 0:
        break
    tiles = [[_ for _ in input().strip()] for __ in range(H)]
    magical_tiles(H, W, tiles)