#include <cstdio>
#include <algorithm>
using namespace std;
char imap[101][101];
int d[101][101];
int h, w;

void dfs(int x, int y, int step) {
    if (d[x][y] != -1) { printf("LOOP\n"); return; }
    d[x][y] = step;
    if (imap[x][y] == '.') { printf("%d %d\n", y, x); return; }
    else if (imap[x][y] == '^') dfs(x-1, y, step+1);
    else if (imap[x][y] == 'v') dfs(x+1, y, step+1);
    else if (imap[x][y] == '>') dfs(x, y+1, step+1);
    else if (imap[x][y] == '<') dfs(x, y-1, step+1);
}


int main()  {

    for (; ;) {
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0) break;
        for (int i = 0; i < h; i++) {
            fill(d[i], d[i]+w, -1);
            scanf("%s", imap[i]);
        }
        dfs(0, 0, 0);
    }
    return 0;
}

