#include <iostream>
#include <string>
#include <sstream>
#include <vector>

#define MAX_W 100
#define MAX_H 100

char room[MAX_H][MAX_W];
int h, w;

void solve() {
    int x=0, y=0;
    bool loop=false;
    while (room[x][y] != '.' && !loop) {
        if (room[x][y] == 'x') {
            loop = true;
        } else if (room[x][y] == '>') {
            room[x][y] = 'x';
            y = y+1;
        } else if (room[x][y] == '<') {
            room[x][y] = 'x';
            y = y-1;
        } else if (room[x][y] == '^') {
            room[x][y] = 'x';
            x = x-1;
        } else { // room[x][y] == 'v'
            room[x][y] = 'x';
            x = x+1;
        }
    }
    if (loop) {
        std::cout << "LOOP" << std::endl;
    } else {
        std::cout << y << ' ' << x << std::endl;
    }
}

void split(const std::string &str) {
    std::string buf;
    std::stringstream ss(str);
    std::vector<std::string> v;
    while (std::getline(ss, buf, ' ')) {
        v.push_back(buf);
    }
    /*
    h = std::stoi(v[0]);
    w = std::stoi(v[1]);
    */
    std::istringstream(v[0]) >> h;
    std::istringstream(v[1]) >> w;
}

int main() {
    std::string line;
    while (std::getline(std::cin, line)) {
        split(line);
        if (h==0 && w==0) break;

        for (int i=0; i<h; i++) {
            for (int j=0; j<w; j++) {
                // scanf("%c", &room[i][j]);
                std::cin >> room[i][j];
            }
        }
        solve();
        std::cin.ignore();
    }
}

