#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int h,w;
    while(cin>>h>>w, h+w){
        vvc v(h,vc(w));
        rep(i,h)rep(j,w)cin>>v[i][j];
        pii now=pii(0,0);
        int cnt=0; bool flag=true;
        for(;cnt<=10000000;cnt++){
            if(v[now.first][now.second]=='>')now=pii(now.first,now.second+1);
            else if(v[now.first][now.second]=='<')now=pii(now.first,now.second-1);
            else if(v[now.first][now.second]=='^')now=pii(now.first-1,now.second);
            else if(v[now.first][now.second]=='v')now=pii(now.first+1,now.second);
            else break;
            if(cnt==10000000) {flag=false; puts("LOOP");}
        }
        if(flag)cout<<now.second<<" "<<now.first<<endl;
    }
}