#include <iostream>
using namespace std;

int main() {
    int H, W;
    
    while (cin >> H >> W && H + W != 0) {
        cin.get();
        
        char room[101][101];

        for (int h = 0; h < H; ++h) {
            for (int w = 0; w < W; ++w) {
                cin >> room[h][w];
            }
        }

        int x = 0, y = 0;
        bool loop = false;

        while (room[x][y] != '.' && !loop) {
            switch (room[x][y]) {
                case '!':
                    loop = true;
                    break;
                case '>':
                    room[x][y] = '!';
                    y++;
                    break;
                case '<':
                    room[x][y] = '!';
                    y--;                
                    break;
                case '^':
                    room[x][y] = '!';
                    x--;    
                    break;
                case 'v':
                    room[x][y] = '!';
                    x++;  
                    break;
            }
        }

        if (loop) {
            cout << "LOOP" << endl;
        }
        else {
            cout << x << " " << y << endl;
        }
    }

    return 0;
}