#include <bits/stdc++.h>
using namespace std;
const int B = 300;
char cmap[100005][10];
pair<int, int> dp[100005][10];
int n, m, q;
void go(int r1, int r2) {
  for (int i = r1; i <= r2; i++) {
    for (int j = 0; j < m; j++) dp[i][j] = make_pair(i, j);
    for (int j = 0; j < m; j++)
      if (cmap[i][j] == '^')
        dp[i][j] = i == r1 ? make_pair(i - 1, j) : dp[i - 1][j];
    for (int j = 0; j < m; j++)
      if (cmap[i][j] == '<') dp[i][j] = j ? dp[i][j - 1] : make_pair(i, j - 1);
    for (int j = m - 1; j >= 0; j--)
      if (cmap[i][j] == '>')
        dp[i][j] = j == m - 1 ? make_pair(i, j + 1) : dp[i][j + 1];
  }
  return;
}
inline int Min(int a, int b) { return a < b ? a : b; }
void init() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < n; i++) scanf("%s", cmap + i);
  for (int i = 0; i <= n; i += B) go(i, Min(n - 1, i + B - 1));
  return;
}
void slove() {
  while (q--) {
    char t;
    int a, b;
    scanf("%s%d%d", &t, &a, &b);
    a--;
    b--;
    if (t == 'A') {
      while (a >= 0 && b >= 0 && b < m) {
        int tx, ty;
        tx = dp[a][b].first;
        ty = dp[a][b].second;
        if (tx == a && ty >= 0 && ty < m) {
          a = tx;
          b = ty;
          break;
        }
        a = tx;
        b = ty;
      }
      if (a >= 0 && b >= 0 && b < m) a = b = -2;
      printf("%d %d\n", a + 1, b + 1);
    } else {
      getchar();
      cmap[a][b] = getchar();
      int buc = a / B;
      go(buc * B, min(n - 1, buc * B + B - 1));
    }
  }
}
int main() {
  init();
  slove();
  return 0;
}
