#include <iostream>
using namespace std;

int main() {
    int X, Y;
    
    while (cin >> X >> Y && X + Y != 0) {
        char room[101][101];
        for (int x = 0; x < X; ++x) {
            for (int y = 0; y < Y; ++y) {
                cin >> room[x][y];
            }
        }

        int steps = 0;
        int x = 0, y = 0;

        while (room[x][y] != '.' && steps < 10000) {
            if (room[x][y] == '>') {
                y++;
            }
            if (room[x][y] == '<') {
                y--;
            }
            if (room[x][y] == '^') {
                x--;
            }
            if (room[x][y] == 'v') {
                x++;
            }
            steps++;
        }

        if (steps >= 10000) {
            cout << "LOOP" << endl;
        }
        else {
            cout << x << " " << y << endl;
        }
    }
    return 0;
}