
import std.stdio, std.string;

void main() {
  for(int h, w; readf("%d %d\n", &h, &w), h + w != 0;) {
    char[][] field = new char[][](h, w);
    bool[][] used = new bool[][](h, w);
    int x = 0, y = 0;
    foreach(uint i; 0..h)
      foreach (uint j, t; readln.chomp)
        field[i][j] = t;

    while(true) {
      if (used[x][y]) {
        writeln("LOOP");
        break;
      }
      used[x][y] = true;
      switch(field[x][y]) {
      case '^':
        x -= 1;
        break;
      case '>':
        y += 1;
        break;
      case 'v':
        x += 1;
        break;
      case '<':
        y -= 1;
        break;
      case '.':
        writeln(x, " ", y);
        goto end;
      default:
        break;
      }
    }
  end:;
  }
}