#include <iostream>
using namespace std;

int main() {
    int H, W;
    
    while (cin >> H >> W && H + W != 0) {
        char room[101][101];

        for (int h = 0; h < H; ++h) {
                cin >> room[h];
        }

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

        while(steps < W*H) {
            if (room[x][y] == '>') y++;
            else if (room[x][y] == '<') y--;
            else if (room[x][y] == '^') x--;
            else if (room[x][y] == 'v') x++;
            else { break; }
            steps++;
        }

        if (steps >= W*H) {
            cout << "LOOP" << endl;
        }
        else {
            cout << x << " " << y << endl;
        }
    }

    return 0;
}