#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b;
    int count=0;
    int loopcheck=0;
    char c;
    while (cin>>a>>b) {
        if (a==0&&b==0) {
            break;
        } else {
            std::vector<vector<char>> vec(a,vector<char>(b));
            for (int i=0;i<a;i++) {
                for (int j=0;j<b;j++) {
                    cin>>c;
                    vec[i][j]=c;
                }
            }
            int tate=0;
            int yoko=0;
            while (vec[tate][yoko]!='.') {
                if (vec[tate][yoko]=='>') {
                    yoko++;
                    count++;
                } else if (vec[tate][yoko]=='<') {
                    yoko--;
                    count++;
                } else if (vec[tate][yoko]=='^') {
                    tate--;
                    count++;
                } else if (vec[tate][yoko=='v']) {
                    tate++;
                    count++;
                }
                if (count>a*b) {
                    cout<<"LOOP"<<endl;
                    loopcheck=1;
                    break;
                }
            }
            if (loopcheck!=1) {
                cout<<yoko<<" "<<tate<<endl;
                tate=0;
                yoko=0;
            }
            loopcheck=0;
            count=0;
        }
    }
}

