#include <bits/stdc++.h>
using namespace std;
struct node {
  node *l, *r, *p, *c;
  int u, v;
  node(int u, int v) : l(0), r(0), p(0), c(0), u(u), v(v) {}
};
inline bool is_root(node *n) {
  return n->p == NULL || n->p->l != n && n->p->r != n;
}
inline bool left(node *n) { return n == n->p->l; }
inline void push(node *n) {}
inline void update(node *n) {}
inline void connect(node *n, node *p, bool l) {
  (l ? p->l : p->r) = n;
  if (n) n->p = p;
}
inline void rotate(node *n) {
  node *p = n->p, *g = p->p;
  bool l = left(n);
  connect(l ? n->r : n->l, p, l);
  if (!is_root(p))
    connect(n, g, left(p));
  else
    n->p = g;
  connect(p, n, !l);
  update(p), update(n);
}
inline void splay(node *n) {
  while (!is_root(n)) {
    node *p = n->p, *g = p->p;
    if (!is_root(p)) push(g);
    push(p), push(n);
    if (!is_root(p)) rotate(left(n) ^ left(p) ? n : p);
    rotate(n);
  }
  push(n);
}
inline node *expose(node *n) {
  node *last = NULL;
  for (node *m = n; m; m = m->p) {
    splay(m);
    m->r = last;
    last = m;
    update(m);
  }
  splay(n);
  return last;
}
node *find_root(node *n) {
  if (n == NULL) return NULL;
  while (n->l) n = n->l;
  return n;
}
void link(node *m, node *n) {
  expose(m);
  if (expose(n) == m)
    m->c = n;
  else
    m->p = n;
}
void cut(node *n) {
  expose(n);
  node *r = find_root(n);
  if (n->l != NULL) {
    n->l->p = NULL;
    n->l = NULL;
  } else {
    n->c = NULL;
  }
  if (r->c != NULL) {
    if (expose(r->c) == n) {
      node *s = r->c;
      r->c = NULL;
      link(r, s);
    }
  }
}
const int MAXN = 100005;
const int MAXM = 15;
int N, M, Q, x, y;
node *T[MAXN][MAXM];
string S;
char C, c;
node *get(int i, int j, int c) {
  if (c == '>') return T[i][j + 1];
  if (c == '^') return T[i - 1][j];
  if (c == '<') return T[i][j - 1];
  if (c == 'v') return T[i + 1][j];
}
int main() {
  ios::sync_with_stdio(0);
  cin >> N >> M >> Q;
  for (int i = 0; i <= N + 1; i++) {
    for (int j = 0; j <= M + 1; j++) {
      T[i][j] = new node(i, j);
    }
  }
  for (int i = 1; i <= N; i++) {
    cin >> S;
    for (int j = 1; j <= M; j++) {
      c = S[j - 1];
      link(T[i][j], get(i, j, c));
    }
  }
  while (Q--) {
    cin >> C >> x >> y;
    if (C == 'A') {
      expose(T[x][y]);
      node *r = find_root(T[x][y]);
      if (r->c)
        cout << "-1 -1\n";
      else
        cout << r->u << ' ' << r->v << '\n';
    } else {
      cin >> c;
      cut(T[x][y]);
      link(T[x][y], get(x, y, c));
    }
  }
}
