#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

void dfs(int u,int v,vector<vector<char>>& M,vector<vector<int>>& F){
	F[v][u]=1;
	switch(M[v][u]){
	case '>':
		if(F[v][u+1]){
			out("LOOP");
			return ;
		}
		dfs(u+1,v,M,F);
		break;
	case '<':
		if(F[v][u-1]){
			out("LOOP");
			return ;
		}
		dfs(u-1,v,M,F);
		break;
	case 'v':
		if(F[v+1][u]){
			out("LOOP");
			return ;
		}
		dfs(u,v+1,M,F);
		break;
	case '^':
		if(F[v-1][u]){
			out("LOOP");
			return ;
		}
		dfs(u,v-1,M,F);
		break;
	default:
		out(u,v);
		return;
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	while(true){
		int H=in(),W=in();
		if(!H && !W) break;
		vector<vector<char>> M(H,vector<char>(W));
		vector<vector<int>> F(H,vector<int>(W,0));
		REP(i,H){
			string S=in<string>();
			REP(j,W){
				M[i][j]=S[j];
			}
		}

		dfs(0,0,M,F);
	}
	return 0;
}

