#include <iostream>
#include <vector>

using namespace std;

int main(){
    int w,h;
    int i,j;
    while(1){
        cin >> w;
        cin >> h;
        if(w == 0 || h == 0) break;
        vector< vector<char> > v(h, vector<char>(w));
        for(j=0;j<h;++j){
            for(i=0;i<w;++i){
                cin >> v[i][j];
            }
        }
        int mi = 0, mj = 0;
        while(true){
            char c = v[mi][mj];
            v[mi][mj] = '#';
            if(c == '>') mi++;
            else if(c == '<') mi--;
            else if(c == '^') mj--;
            else if(c == 'v') mj++;
            else if(c == '#'){
                cout << "LOOP" << endl;
                break;
            } else if( c == '.' ){
                cout << mi << ' ' << mj << endl;
                break;
            }
        }
    }
    return 0;
}