#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const int MAX = 1.2e6 + 100;
namespace lct {
struct node {
  int p, ch[2];
  node() { p = ch[0] = ch[1] = -1; }
};
node t[MAX];
bool is_root(int x) {
  return t[x].p == -1 or (t[t[x].p].ch[0] != x and t[t[x].p].ch[1] != x);
}
void rotate(int x) {
  int p = t[x].p, pp = t[p].p;
  if (!is_root(p)) t[pp].ch[t[pp].ch[1] == p] = x;
  bool d = t[p].ch[0] == x;
  t[p].ch[!d] = t[x].ch[d], t[x].ch[d] = p;
  if (t[p].ch[!d] + 1) t[t[p].ch[!d]].p = p;
  t[x].p = pp, t[p].p = x;
}
void splay(int x) {
  while (!is_root(x)) {
    int p = t[x].p, pp = t[p].p;
    if (!is_root(p)) rotate((t[pp].ch[0] == p) ^ (t[p].ch[0] == x) ? x : p);
    rotate(x);
  }
}
int access(int v) {
  int last = -1;
  for (int w = v; w + 1; last = w, splay(v), w = t[v].p)
    splay(w), t[w].ch[1] = (last == -1 ? -1 : v);
  return last;
}
int find_root(int v) {
  access(v);
  while (t[v].ch[0] + 1) v = t[v].ch[0];
  return splay(v), v;
}
void link(int v, int w) {
  access(v);
  t[v].p = w;
}
void cut(int v) {
  access(v);
  t[v].ch[0] = t[t[v].ch[0]].p = -1;
}
int lca(int v, int w) { return access(v), access(w); }
}  // namespace lct
char B[MAX];
int ciclo[MAX];
int n, m;
int get(int i, int j) { return i * (m + 2) + j; }
pair<int, int> volta(int x) { return {x / (m + 2), x % (m + 2)}; }
int nxt(int x) {
  pair<int, int> xx = volta(x);
  if (B[x] == '<') xx.second--;
  if (B[x] == '>') xx.second++;
  if (B[x] == '^') xx.first--;
  return get(xx.first, xx.second);
}
bool show(pair<int, int> x) {
  return !x.first or !x.second or x.first == n + 1 or x.second == m + 1;
}
void linka(int at) {
  int nx = nxt(at);
  if (lct::find_root(nx) == at) {
    ciclo[at] = nx;
    return;
  }
  lct::link(at, nx);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int at = get(i, j);
      cin >> B[at];
      linka(at);
    }
  while (q--) {
    char op;
    cin >> op;
    int i, j;
    cin >> i >> j;
    int at = get(i, j);
    if (op == 'A') {
      pair<int, int> rt = volta(lct::find_root(at));
      if (show(rt))
        cout << rt.first << " " << rt.second << '\n';
      else
        cout << "-1 -1" << '\n';
    } else {
      cin >> B[at];
      int rt = lct::find_root(at);
      int ponta = -1;
      if (at != rt) {
        if (!show(volta(rt))) {
          int c = ciclo[rt];
          if (lct::lca(at, c) == at) ponta = c;
        }
        lct::cut(at);
      }
      if (ponta != -1) lct::link(rt, ponta);
      linka(at);
    }
  }
  exit(0);
}
