#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<char> > arr(n + 1, vector<char>(m + 2));
  vector<vector<int> > vals(n + 1, vector<int>(m + 2));
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < m; ++j) scanf("\n %c", &arr[i + 1][j + 1]);
  int block = sqrt(n);
  int numBlocks = ceil(1.0 * n / block);
  function<int(int, int, int)> go = [&](int i, int j, int up) {
    if (i == up || j == 0 || j == m + 1) return i * (m + 3) + j;
    if (vals[i][j] != -1) return vals[i][j];
    vals[i][j] = -2;
    int newI = i, newJ = j;
    if (arr[i][j] == '^')
      --newI;
    else if (arr[i][j] == '>')
      ++newJ;
    else
      --newJ;
    return vals[i][j] = go(newI, newJ, up);
  };
  function<void(int, int)> RecalcBlock = [&](int start, int end) {
    for (int i = start; i <= end; ++i)
      for (int j = 1; j <= m; ++j) vals[i][j] = -1;
    for (int i = end; i >= start; --i)
      for (int j = 1; j <= m; ++j) go(i, j, start - 1);
  };
  for (int i = 0; i < numBlocks; ++i)
    RecalcBlock(i * block + 1, min(n, (i + 1) * block));
  while (q--) {
    char command, c;
    int x, y;
    scanf("\n %c %d %d", &command, &x, &y);
    if (command == 'A') {
      int res;
      while (1) {
        res = vals[x][y];
        if (res == -2) break;
        x = res / (m + 3);
        y = res % (m + 3);
        if (x == 0 || y == 0 || y == m + 1) break;
      }
      if (res == -2)
        printf("-1 -1\n");
      else
        printf("%d %d\n", x, y);
    } else {
      scanf("\n %c", &c);
      arr[x][y] = c;
      for (int i = 0; i < numBlocks; ++i)
        if (i * block + 1 <= x && x <= (i + 1) * block)
          RecalcBlock(i * block + 1, min(n, (i + 1) * block));
    }
  }
  return 0;
}
