#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long a = 0, b = getchar(), c = 1;
  while (!isdigit(b)) c = b == '-' ? -1 : 1, b = getchar();
  while (isdigit(b)) a = a * 10 + b - '0', b = getchar();
  return a * c;
}
pair<int, int> dp[100005][16];
char s[100005][15], t[5];
int n, m, q, Z = 256, x, y;
void gao(int r1, int r2);
int main() {
  n = read(), m = read(), q = read();
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  for (int i = 1; i <= n; i += Z) gao(i, min(n, i + Z - 1));
  while (q--) {
    scanf("%s%d%d", &t, &x, &y);
    if (t[0] == 'A') {
      int r = x, c = y;
      while (r >= 1 and c >= 1 and c <= m) {
        int nr = dp[r][c].first, nc = dp[r][c].second;
        if (nr == r and (nc >= 1 and nc <= m)) {
          r = nr, c = nc;
          break;
        }
        r = nr, c = nc;
      }
      if (r >= 1 and (c >= 1 and c <= m)) r = c = -1;
      printf("%d %d\n", r, c);
    } else {
      getchar(), s[x][y] = getchar();
      gao(min((x / Z) * Z + 1, n), min(n, (x / Z) * Z + Z));
    }
  }
  return 0;
}
void gao(int r1, int r2) {
  for (int i = r1; i <= r2; i++) {
    for (int j = 1; j <= m; j++) dp[i][j] = make_pair(i, j);
    for (int j = 1; j <= m; j++)
      if (s[i][j] == '^')
        dp[i][j] = (i == r1) ? make_pair(r1 - 1, j) : dp[i - 1][j];
    for (int j = 1; j <= m; j++)
      if (s[i][j] == '<') dp[i][j] = (j == 1) ? make_pair(i, 0) : dp[i][j - 1];
    for (int j = m; j >= 1; j--)
      if (s[i][j] == '>')
        dp[i][j] = (j == m) ? make_pair(i, m + 1) : dp[i][j + 1];
  }
}
