#include <bits/stdc++.h>
char OUTBUF[20], INBUF, *IT;
inline void in(int &x) {
  while ((INBUF = getchar()) < '0')
    ;
  for (x = INBUF - '0'; (INBUF = getchar()) >= '0';
       x += (x << 3) + x + INBUF - '0')
    ;
}
inline void out(int x) {
  *OUTBUF = x % 10;
  for (IT = OUTBUF + 1; x /= 10;) *IT++ = x % 10;
  while (IT != OUTBUF) putchar(*--IT + '0');
  putchar('\n');
}
using namespace std;
template <class T, class L>
bool smax(T &x, L y) {
  return x < y ? (x = y, 1) : 0;
}
template <class T, class L>
bool smin(T &x, L y) {
  return x > y ? (x = y, 1) : 0;
}
const int maxn = 1e5 + 17, maxm = 17, sq = 3e2 + 17;
int n, m, q;
pair<int, int> go[maxn][maxm];
char c[maxn][maxm];
bool mark[maxn][maxm];
pair<int, int> get(int x, int y) {
  if (x < 0 || y < 0 || y >= m) return {x, y};
  if (~go[x][y].first) return go[x][y];
  if (c[x][y] == '^')
    return x % sq ? go[x][y] = get(x - 1, y) : go[x][y] = {x - 1, y};
  if (mark[x][y]) return go[x][y] = {-2, -2};
  mark[x][y] = 1;
  if (c[x][y] == '>') go[x][y] = get(x, y + 1);
  if (c[x][y] == '<') go[x][y] = get(x, y - 1);
  mark[x][y] = 0;
  return go[x][y];
}
bool ok(pair<int, int> x) {
  return (x.first >= 0 && x.second >= 0 && x.second < m);
}
int main() {
  cin >> n >> m >> q;
  memset(go, -1, sizeof go);
  for (int i = 0; i < n; i++, getchar())
    for (int j = 0; j < m; j++) cin >> c[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) get(i, j);
  for (int x, y; q--;) {
    char t;
    cin >> t;
    if (t == 'C') {
      cin >> x >> y, x--, y--;
      cin >> c[x][y];
      for (int i = x; (i == x || i % sq) && i < n; i++)
        for (int j = 0; j < m; j++) go[i][j] = {-1, -1};
      for (int i = x; (i == x || i % sq) && i < n; i++)
        for (int j = 0; j < m; j++) get(i, j);
    } else {
      cin >> x >> y;
      pair<int, int> cur = {x - 1, y - 1};
      while (ok(cur)) {
        cur = go[cur.first][cur.second];
      }
      cout << cur.first + 1 << ' ' << cur.second + 1 << '\n';
    }
  }
  return 0;
}
