#include <iostream>
using namespace std;
int main(void){
    int x,y;
    int h,w;
    string in;
    while(true) {
        char** stage;
        bool** nowplace;
        cin >> h;
        cin >> w;
        cin.ignore();
        if (h == 0) {
            break;
        }
        stage = new char*[h];
        nowplace = new bool*[h];
        for(int i = 0; i < h; ++i) {
            stage[i] = new char[w];
            nowplace[i] = new bool[w];
        }
        for(int i = 0; i < h; ++i) {
            getline(cin, in);
            for(int j = 0; j < w; ++j) {
                stage[i][j] = in[j];
                nowplace[i][j] = false;
            }
        }
        x = 0;
        y = 0;
    char now;
        while(true) {
            now = stage[y][x];
            if (now == '.') {
                cout << x << " " << y << endl;
                break;
            }
            else {
                if (nowplace[y][x] == false) {
                    nowplace[y][x] = true;
                }
                else {
                    cout << "LOOP" << endl;
                    break;
                }
                if (now == '>') {
                    ++x;
                }
                else if (now == '<') {
                    --x;
                }
                else if (now == '^') {
                    --y;
                }
                else if (now == 'v') {
                    ++y;
                }
            }
        }
        for(int i = 0; i < h; ++i) {
            delete [] stage[i];
            delete [] nowplace[i];
        }
        delete [] stage;
        delete [] nowplace;
    }
}