#include <iostream>
#include <vector>
using namespace std;

int main() {
    int H, W;
    
    while (cin >> H >> W && H + W != 0) {
        cin.get();
        cin.get();
        vector<string> room;
        for (int h = 0; h < H; ++h) {
            string line;
            getline(cin, line);
            room.push_back(line);
        }

        int steps = 0;
        int x = 0, y = 0;
        bool loop = false;

        while (room[x][y] != '.') {
            if (room[x][y] == '!') {
                loop = true;
                break;
            }
            if (room[x][y] == '>') {
                room[x][y] = '!';
                y++;
            }
            if (room[x][y] == '<') {
                room[x][y] = '!';
                y--;
            }
            if (room[x][y] == '^') {
                room[x][y] = '!';
                x--;
            }
            if (room[x][y] == 'v') {
                room[x][y] = '!';
                x++;
            }
        }

        if (loop) {
            cout << "LOOP" << endl;
        }
        else {
            cout << x << " " << y << endl;
        }
    }
    return 0;
}