#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T x; cin >> x; return x; }

signed main()
{
	while (true) {
		int h = in(), w = in();
		if (h == 0 && w == 0) {
			break;
		}
		vector<vector<char>>tile(h, vector<char>(w));
		vector<vector<bool>>step(h, vector<bool>(w, false));
		REP(i, h) {
			REP(j, w) {
				tile[i][j] = in<char>();
			}
		}
		int x = 0, y = 0;
		while (true) {
			step[y][x] = true;
			switch (tile[y][x]) {
			case '>':
				++x;
				break;
			case '<':
				--x;
				break;
			case '^':
				--y;
				break;
			case 'v':
				++y;
				break;
			}
			if (tile[y][x] == '.') {
				cout << x << ' ' << y << endl;
				break;
			} else if (step[y][x]) {
				cout << "LOOP" << endl;
				break;
			}
		}
	}
}
