#include <bits/stdc++.h>
using namespace std;
const int N = 100002, M = 12, BLOCK_SIZE = 320;
int n, m, q;
pair<int, int> par_block[N][M];
char grid[N][M];
pair<int, int> get_next_block(int x, int y, int prevX, int prevY, int b) {
  if (!x || x > n || !y || y > m) return {x, y};
  if (x / BLOCK_SIZE < b) return {x, y};
  if (par_block[x][y] != pair<int, int>(-2, -2)) return par_block[x][y];
  int newX = x, newY = y;
  if (grid[x][y] == '^') --newX;
  if (grid[x][y] == '>') ++newY;
  if (grid[x][y] == '<') --newY;
  if (newX == prevX && newY == prevY) return {-1, -1};
  return par_block[x][y] = get_next_block(newX, newY, x, y, b);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i) scanf("%s", grid[i] + 1);
  for (int i = 0; i <= n + 1; ++i)
    for (int j = 0; j <= m + 1; ++j) par_block[i][j] = {-2, -2};
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      par_block[i][j] = get_next_block(i, j, -1, -1, i / BLOCK_SIZE);
  while (q--) {
    char ch;
    int x, y;
    scanf(" %c%d%d", &ch, &x, &y);
    if (ch == 'C') {
      scanf(" %c", &grid[x][y]);
      int rBlck = min((x / BLOCK_SIZE + 1) * BLOCK_SIZE, n);
      for (int i = x; i <= rBlck; ++i)
        for (int j = 1; j <= m; ++j) par_block[i][j] = {-2, -2};
      for (int i = x; i <= rBlck; ++i)
        for (int j = 1; j <= m; ++j)
          par_block[i][j] = get_next_block(i, j, -1, -1, i / BLOCK_SIZE);
    } else {
      pair<int, int> ans = get_next_block(x, y, -1, -1, x / BLOCK_SIZE);
      while (ans.first > 0 && ans.second > 0 && ans.second <= m)
        ans = get_next_block(ans.first, ans.second, -1, -1,
                             ans.first / BLOCK_SIZE);
      printf("%d %d\n", ans.first, ans.second);
    }
  }
  return 0;
}
