#include <iostream>
using namespace std;

int main() {
    while (true) {
        int h, w;
        cin >> h >> w;
        if (h == 0 && w == 0) {
            break;
        }
        char** field = new char* [h];
        for (int i = 0; i < h; i++) {
            field[i] = new char [w + 1];
        }
        for (int i = 0; i < h; i++) {
            cin >> field[i];
        }
        int x = 0, y = 0;
        char op = field[y][x];
        while (op != '.' && op != '0') {
            field[y][x] = '0';
            switch (op) {
            case '>':
                x++;
                break;
            case '<':
                x--;
                break;
            case '^':
                y--;
                break;
            case 'v':
                y++;
                break;
            }
            op = field[y][x];
        }
        if (op == '.') {
            cout << x << " " << y << endl;
        } else if (op == '0') {
            cout << "LOOP" << endl;
        }
        for (int i = 0; i < h; i++) {
            delete[] field[i];
        }
        delete[] field;
    }
}