#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 1;
const int MAXM = 12;
const int SZ = 250;
int n, m, q;
pair<int, int> dest[MAXN][MAXM];
char v[MAXN][MAXM];
int t[MAXN][MAXM], tt = 0;
bool ok[MAXN][MAXM];
pair<int, int> dfs(int x, int y) {
  t[x][y] = tt;
  ok[x][y] = 1;
  int nx = -1, ny;
  switch (v[x][y]) {
    case '^':
      nx = x - 1;
      ny = y;
      break;
    case '<':
      nx = x;
      ny = y - 1;
      break;
    case '>':
      nx = x;
      ny = y + 1;
      break;
    default:
      break;
  }
  if (nx == 0 || ny == 0 || nx > n || ny > m) {
    dest[x][y].first = nx;
    dest[x][y].second = ny;
  } else if ((nx - 1) / SZ != (x - 1) / SZ) {
    dest[x][y].first = nx;
    dest[x][y].second = ny;
  } else if (t[nx][ny] == tt) {
    dest[x][y].first = -1;
    dest[x][y].second = -1;
  } else if (nx == x && ny > y) {
    dest[x][y] = dfs(nx, ny);
  } else {
    dest[x][y] = dest[nx][ny];
  }
  return dest[x][y];
}
void procBlock(int a) {
  int lim = min(a * SZ + SZ, n);
  for (int i = a * SZ + 1; i <= lim; i++) {
    for (int k = 1; k <= m; k++) {
      ok[i][k] = 0;
    }
  }
  for (int i = a * SZ + 1; i <= lim; i++) {
    for (int k = 1; k <= m; k++) {
      if (!ok[i][k]) {
        tt++;
        dfs(i, k);
      }
    }
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    for (int k = 1; k <= m; k++) {
      scanf(" %c", &v[i][k]);
    }
  }
  for (int i = 0; i <= n + 1; i++) {
    for (int k = 0; k <= m + 1; k++) {
      ok[i][k] = 1;
      dest[i][k].first = i;
      dest[i][k].second = k;
    }
  }
  for (int a = 0; a * SZ + 1 <= n; a++) procBlock(a);
  char op;
  int x, y;
  char to;
  pair<int, int> p;
  while (q--) {
    scanf(" %c", &op);
    if (op == 'C') {
      scanf("%d %d %c", &x, &y, &to);
      v[x][y] = to;
      procBlock((x - 1) / SZ);
    } else {
      scanf("%d %d", &x, &y);
      while (x > 0 && x <= n && y > 0 && y <= m) {
        p = dest[x][y];
        x = p.first;
        y = p.second;
      }
      printf("%d %d\n", x, y);
    }
  }
}
