#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y <= x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x <= y ? x = y, 1 : 0;
}
const long double eps = 1e-9;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long loo = 1ll << 60;
const int MAXN = 2000005;
const int MAXM = 4005;
const int MAXP = 7000000;
const int MX = 20;
const int G = 3;
const int mods = 1e9 + 7;
const int Gi = (mods + 1) / G;
const int SZ = 62;
const int inv2 = (mods + 1) >> 1;
const int INF = 0x3f3f3f3f;
namespace FastIO {
constexpr int SIZE = (1 << 21) + 1;
int num = 0, f;
char ibuf[SIZE], obuf[SIZE], que[65], *iS, *iT, *oS = obuf,
                                                *oT = obuf + SIZE - 1, c;
inline void flush() {
  fwrite(obuf, 1, oS - obuf, stdout);
  oS = obuf;
}
inline void putc(char c) {
  *oS++ = c;
  if (oS == oT) flush();
}
inline void getc(char &c) {
  for (c = (iS == iT ? (iT = ((iS = ibuf) + fread(ibuf, 1, SIZE, stdin)),
                       (iS == iT ? EOF : *iS++))
                     : *iS++);
       (c == ' ' || c == '\0' || c == '\n') && c != EOF;
       c = (iS == iT ? (iT = ((iS = ibuf) + fread(ibuf, 1, SIZE, stdin)),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    ;
}
inline void reads(char *st) {
  char c;
  int n = 0;
  getc(st[++n]);
  for (c = (iS == iT ? (iT = ((iS = ibuf) + fread(ibuf, 1, SIZE, stdin)),
                       (iS == iT ? EOF : *iS++))
                     : *iS++);
       c != ' ' && c != '\0' && c != '\n';
       c = (iS == iT ? (iT = ((iS = ibuf) + fread(ibuf, 1, SIZE, stdin)),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    st[++n] = c;
  st[++n] = '\0';
}
template <class I>
inline void read(I &x) {
  for (f = 1, c = (iS == iT ? (iT = ((iS = ibuf) + fread(ibuf, 1, SIZE, stdin)),
                              (iS == iT ? EOF : *iS++))
                            : *iS++);
       c < '0' || c > '9';
       c = (iS == iT ? (iT = ((iS = ibuf) + fread(ibuf, 1, SIZE, stdin)),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    if (c == '-') f = -1;
  for (x = 0; c >= '0' && c <= '9';
       c = (iS == iT ? (iT = ((iS = ibuf) + fread(ibuf, 1, SIZE, stdin)),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    x = (x << 3) + (x << 1) + (c & 15);
  x *= f;
}
template <class I>
inline void print(I x) {
  if (x < 0) putc('-'), x = -x;
  if (!x) putc('0');
  while (x) que[++num] = x % 10 + 48, x /= 10;
  while (num) putc(que[num--]);
}
inline void putstr(string st) {
  for (int i = 0; i < (int)st.size(); ++i) putc(st[i]);
}
struct Flusher_ {
  ~Flusher_() { flush(); }
} io_Flusher_;
}  // namespace FastIO
using FastIO ::getc;
using FastIO ::print;
using FastIO ::putc;
using FastIO ::putstr;
using FastIO ::read;
using FastIO ::reads;
pair<long long, long long> wh[MAXN];
char st[20];
int IDnum = 0, n, m, Case, sz, id[100005][12], L[505], R[505], bel[MAXN],
    Nxt[MAXN], nxt[MAXN], flag[MAXN];
int get(int x, int y, char c) {
  if (c == '<') return id[x][y - 1];
  if (c == '>') return id[x][y + 1];
  return id[x - 1][y];
}
int dfs(int x) {
  if (!flag[x]) return Nxt[x];
  if (bel[wh[nxt[x]].first] != bel[wh[x].first])
    Nxt[x] = nxt[x];
  else if (wh[nxt[x]].second == 0 || wh[nxt[x]].second == m + 1)
    Nxt[x] = -1;
  else if (nxt[nxt[x]] == x)
    Nxt[x] = -1;
  else
    Nxt[x] = dfs(nxt[x]);
  flag[x] = 0;
  return Nxt[x];
}
void update(int x, int y, int t) {
  nxt[id[x][y]] = t;
  for (int i = x; i <= R[bel[x]]; ++i)
    for (int j = 1; j <= m; ++j) flag[id[i][j]] = 1;
  for (int i = x; i <= R[bel[x]]; ++i)
    for (int j = 1; j <= m; ++j) dfs(id[i][j]);
}
void query(int x, int y) {
  int t = id[x][y];
  while (nxt[t] != t && nxt[nxt[t]] != t)
    if (Nxt[t] != -1)
      t = Nxt[t];
    else
      t = nxt[t];
  if (nxt[t] == t)
    print(wh[t].first), putc(' '), print(wh[t].second);
  else
    print(-1), putc(' '), print(-1);
  putc('\n');
}
void Init() {
  sz = (int)sqrt(n);
  for (int i = 1; i <= n; ++i) bel[i] = (i - 1) / sz + 1;
  for (int i = 1; i <= n; ++i)
    if (!L[bel[i]]) L[bel[i]] = i;
  for (int i = n; i >= 1; --i)
    if (!R[bel[i]]) R[bel[i]] = i;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) flag[id[i][j]] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) dfs(id[i][j]);
}
signed main() {
  read(n), read(m), read(Case);
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= m + 1; ++j)
      id[i][j] = ++IDnum, nxt[id[i][j]] = Nxt[id[i][j]] = id[i][j],
      wh[id[i][j]] = make_pair(i, j);
  for (int i = 1; i <= n; ++i) {
    reads(st);
    for (int j = 1; j <= m; ++j) nxt[id[i][j]] = get(i, j, st[j]);
  }
  Init();
  while (Case--) {
    int x, y;
    reads(st), read(x), read(y);
    if (st[1] == 'A') {
      query(x, y);
      continue;
    }
    reads(st);
    update(x, y, get(x, y, st[1]));
  }
  return 0;
}
