#include <iostream>
#include <string>
using namespace std;

int main(){
  int n ,m;
  while( true ){
    cin >> n >> m;
    if( n == 0 && m == 0 ){
      break;
    }
    string tail[n];
    int mass[n][m];
    for( int i=0 ; i<n ; i++ ){ 
      for( int j=0 ; j<m ; j++ ){
	mass[i][j] = 0;
      }
    }

    for( int i=0 ; i<n ; i++ ){
      cin >> tail[i];
    }
    
    n = 0; m = 0;
    
    while( true ){
      if( mass[n][m] == 1 ){
	cout << "LOOP" << endl;
	break;
      }
      else if( tail[n][m] == '>' ){
	mass[n][m] = 1;
	m++;
      }
      else if( tail[n][m] == '<' ){
     	mass[n][m] = 1;
	m--;
      }
      else if( tail[n][m] == '^' ){
	mass[n][m] = 1;
	n--;
      }
      else if( tail[n][m] == 'v' ){
       	mass[n][m] = 1;
	n++;
      }
      else if( tail[n][m] == '.' ){
	cout << m << ' ' << n << endl;
	break;
      }
    }
  }
}