#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<cmath>
using namespace std;

int main(){
	int n,m;
	cin>>n>>m;
	stringstream buff;
	while(n!=0 && m!=0){
		map<string,int> table;
		vector<string> args;
		for(int x=0;x<n;++x){
			string line;
			cin>>line;
			args.push_back(line);
		}
		int x=0,y=0;
		bool flag = true;
		while(args[x][y]!='.' && flag){
			stringstream buf;
			buf<<x<<":"<<y;
			if(table[buf.str()]){
				flag = false;
			}else{
					table[buf.str()]=100;
				switch(args[x][y]){
					case '>':
						++y;
						break;
					case '<':
							--y;
						break;
					case 'v':
						++x;
						break;
					case '^':
						--x;
						break;
						
				}
			}
		}
		if(flag)buff<<y<<" "<<x<<"\n";
		else	buff<<"LOOP\n";
		cin>>n>>m;
	}
	cout<<buff.str();
	return 0;
}