#include <string.h>
#include <stdio.h>

int main(void) {                                                                
    int h, w, i, j, exitflag;                                                   
    char matrix[101][101];                                                      
                                                                                
    while (scanf("%d %d", &h, &w), h != 0 && w != 0) {                          
        getchar();                                                              
        for (i = 0; i < h; i++) {                                               
            fgets(matrix[i], w + 2, stdin); // + \n                             
        }                                                                       
                                                                                
        exitflag = 1;                                                           
        i = j = 0;                                                              
        while (exitflag) {                                                      
            switch (matrix[i][j]) {                                             
            case '>':                                                           
                matrix[i][j] = 'x';                                             
                j++;                                                            
                break;                                                          
            case 'v':                                                           
                matrix[i][j] = 'x';                                             
                i++;                                                            
                break;                                                          
            case '<':                                                           
                matrix[i][j] = 'x';                                             
                j--;                                                            
                break;                                                          
            case '^':                                                           
                matrix[i][j] = 'x';                                             
                i--;                                                            
                break;                                                          
            case 'x':                                                           
                printf("LOOP\n");                                               
                exitflag = 0;                                                   
                break;                                                          
            case '.':                                                           
                printf("%d %d\n", j, i);                                        
                exitflag = 0;                                                   
                break;                                                          
            }                                                                   
        }                                                                       
    }                                                                           
                                                                                
    return 0;                                                                   
}

Measured memory_bytes: 632