#include<iostream>
using namespace std;

int main(){
   int a, b, i, j;
   char map[102][102];
   
   while(1){
      cin >> a >> b;
      if(a+b==0) break;
      
      for(i=0; i< a; i++){
         for(j=0; j< b; j++){
            cin >> map[i][j];
         }
      }
      i=0;j=0;
      while(1){
         if(map[i][j]=="."){
            cout << i << " " << j << endl;
            break;
         }else if(map[i][j]=="#"){
            cout << "loop" << endl;
            break;
         }else if(map[i][j]==">"){
            map[i][j]="#";
            j++;
         }else if(map[i][j]=="<"){
            map[i][j]="#";
            j--;
         }else if(map[i][j]=="^"){
            map[i][j]="#";
            i++;
         }else if(map[i][j]=="v"){
            map[i][j]="#";
            i--;
         }
      }
   }
   return 0;
}