Buggy python submission (verdict: Runtime Error):
posX,posY=0,0
H,W=map(int,input())
for i in range(H):
    spam=input().rstrip()
    for j in range(W):
        if posX==j:
            if spam[j]=='>': posX+=1
            elif spam[j]=='<': posX-=1
            elif spam[j]=='v': posY+=1
            elif spam[j]=='^': posY-=1
        else: break

Fixed submission:
H,W=1,1
while True:
    posX,posY=0,0
    H,W=map(int,input().split())
    if (H==W==0)==True:
        break
    tile=[[False for i in range(W)] for j in range(H)]
    tileinfo=[['' for i in range(W)] for j in range(H)]
    for i in range(H):
        tileinfo[i]=input().rstrip()
    while True:
        if tile[posY][posX]==True:
            print('LOOP')
            break
        else:
            tile[posY][posX]=True
        if tileinfo[posY][posX]=='>':
            posX+=1
        elif tileinfo[posY][posX]=='<':
            posX-=1
        elif tileinfo[posY][posX]=='v':
            posY+=1
        elif tileinfo[posY][posX]=='^':
            posY-=1
        elif tileinfo[posY][posX]=='.':
            print('{} {}'.format(posX,posY))
            break

Buggy python submission (verdict: Runtime Error):
posX,posY=0,0
H,W=map(int,input().split())
while not(H==W==0):
    tile=[[False for i in range(W)] for j in range(H)]
    tileinfo=[['' for i in range(W)] for j in range(H)]
    for i in range(H):
        tileinfo[i]=input().rstrip()
    while True:
        if tileinfo[posX][posY]=='>': posX+=1
        elif tileinfo[posX][posY]=='<': posX-=1
        elif tileinfo[posX][posY]=='v':
            posY+=1
            break
        elif tileinfo[posX][posY]=='^':
            posY-=1
            break
        elif spam[j]=='.': break
        if tile[posX][posY]==True:
            print('LOOP')
            break
        else:
            tile[posX][posY]=True

Fixed submission:
H,W=1,1
while True:
    posX,posY=0,0
    H,W=map(int,input().split())
    if (H==W==0)==True:
        break
    tile=[[False for i in range(W)] for j in range(H)]
    tileinfo=[['' for i in range(W)] for j in range(H)]
    for i in range(H):
        tileinfo[i]=input().rstrip()
    while True:
        if tile[posY][posX]==True:
            print('LOOP')
            break
        else:
            tile[posY][posX]=True
        if tileinfo[posY][posX]=='>':
            posX+=1
        elif tileinfo[posY][posX]=='<':
            posX-=1
        elif tileinfo[posY][posX]=='v':
            posY+=1
        elif tileinfo[posY][posX]=='^':
            posY-=1
        elif tileinfo[posY][posX]=='.':
            print('{} {}'.format(posX,posY))
            break

Buggy python submission (verdict: Time Limit Exceeded):
posX,posY=0,0
H,W=map(int,input().split())
while not(H==W==0):
    tile=[[False for i in range(W)] for j in range(H)]
    tileinfo=[['' for i in range(W)] for j in range(H)]
    for i in range(H):
        tileinfo[i]=input().rstrip()
    while True:
        if tileinfo[posX][posY]=='>':
            posX+=1
            continue
        elif tileinfo[posX][posY]=='<':
            posX-=1
            continue
        elif tileinfo[posX][posY]=='v':
            posY+=1
            continue
        elif tileinfo[posX][posY]=='^':
            posY-=1
            continue
        elif tileinfo[posX][posY]=='.':
            print('{} {}'.format(posX,posY))
            break
        if tile[posX][posY]==True:
            print('LOOP')
            break
        else:
            tile[posX][posY]=True

Fixed submission:
H,W=1,1
while True:
    posX,posY=0,0
    H,W=map(int,input().split())
    if (H==W==0)==True:
        break
    tile=[[False for i in range(W)] for j in range(H)]
    tileinfo=[['' for i in range(W)] for j in range(H)]
    for i in range(H):
        tileinfo[i]=input().rstrip()
    while True:
        if tile[posY][posX]==True:
            print('LOOP')
            break
        else:
            tile[posY][posX]=True
        if tileinfo[posY][posX]=='>':
            posX+=1
        elif tileinfo[posY][posX]=='<':
            posX-=1
        elif tileinfo[posY][posX]=='v':
            posY+=1
        elif tileinfo[posY][posX]=='^':
            posY-=1
        elif tileinfo[posY][posX]=='.':
            print('{} {}'.format(posX,posY))
            break

Buggy python submission (verdict: Runtime Error):
posX,posY=0,0
H,W=map(int,input().split())
while not(H==W==0):
    tile=[[False for i in range(W)] for j in range(H)]
    tileinfo=[['' for i in range(W)] for j in range(H)]
    for i in range(H):
        tileinfo[i]=input().rstrip()
    while True:
        if tileinfo[posX][posY]=='>':
            posX+=1
        elif tileinfo[posX][posY]=='<':
            posX-=1
        elif tileinfo[posX][posY]=='v':
            posY+=1
        elif tileinfo[posX][posY]=='^':
            posY-=1
        elif tileinfo[posX][posY]=='.':
            print('{} {}'.format(posX,posY))
            break
        if tile[posX][posY]==True:
            print('LOOP')
            break
        else:
            tile[posX][posY]=True

Fixed submission:
H,W=1,1
while True:
    posX,posY=0,0
    H,W=map(int,input().split())
    if (H==W==0)==True:
        break
    tile=[[False for i in range(W)] for j in range(H)]
    tileinfo=[['' for i in range(W)] for j in range(H)]
    for i in range(H):
        tileinfo[i]=input().rstrip()
    while True:
        if tile[posY][posX]==True:
            print('LOOP')
            break
        else:
            tile[posY][posX]=True
        if tileinfo[posY][posX]=='>':
            posX+=1
        elif tileinfo[posY][posX]=='<':
            posX-=1
        elif tileinfo[posY][posX]=='v':
            posY+=1
        elif tileinfo[posY][posX]=='^':
            posY-=1
        elif tileinfo[posY][posX]=='.':
            print('{} {}'.format(posX,posY))
            break