#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; ++i)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define P pair<int, int>

int main() {
  int w, h;
  while(cin >>w >>h && w){
    vector<string> v(h);
    REP(i, h) cin >>v[i];
    vector< vector<bool> > visited(h, vector<bool>(w, false));
    int ny = 0, nx = 0;
    while(v[ny][nx] != '.' && !visited[ny][nx]){
      visited[ny][nx] = true;
      if(v[ny][nx] == '>') ++nx;
      if(v[ny][nx] == '<') --nx;
      if(v[ny][nx] == 'v') ++ny;
      if(v[ny][nx] == '^') --ny;
    }
    if(!visited[ny][nx]) cout <<nx <<" " <<ny <<endl;
    else cout <<"LOOP" <<endl;
  }
  return 0;
}