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

typedef std::pair<int,int> coordinate;

int main()
{
	while (true) {
		int H, W;
		std::cin >> H >> W;
		if ( H==0 && W==0 ) break;
		
		std::string* board = new std::string[H];
		for (int i=0; i<H; i++) {
			std::cin >> board[i];
		}
		
		coordinate curr_pos = coordinate(0,0);
		int count = 0;
		while (true) {
			char mark = board[curr_pos.first][curr_pos.second];
			if (mark == '.') {
				std::cout << curr_pos.second << " " << curr_pos.first << std::endl;
				break;
			} else if (mark == '>') {
				curr_pos.second++;
			} else if (mark == '<') {
				curr_pos.second--;
			} else if (mark == '^') {
				curr_pos.first--;
			} else {
				curr_pos.first++;
			}
			count++;
			if (count > H * W) {
				std::cout << "LOOP" << std::endl;
				break;
			}
		}
	}
	return 0;
}

