#include <bits/stdc++.h>
using namespace std;
const string NAME = "487D";
const int dx[] = {-1, 0, 0};
const int dy[] = {0, -1, 1};
const int N = 1e5 + 10;
const int M = 12;
const int K = 350;
int n, m, q, a[N][M], k, g[K], ok[N][M], in[N][M], id[N], cnt = 0;
pair<int, int> ed[N][M];
void input() {
  cin >> n >> m >> q;
  k = sqrt(n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      char c;
      cin >> c;
      if (c == '^')
        a[i][j] = 0;
      else if (c == '<')
        a[i][j] = 1;
      else
        a[i][j] = 2;
    }
}
bool out(int x, int y) {
  if (x == 0 or y == 0 or y == m + 1) return true;
  return false;
}
void dfs(int x, int y, int gr) {
  int t = a[x][y];
  int nx = x + dx[t], ny = y + dy[t];
  if (out(nx, ny) or nx == g[gr + 1]) {
    ed[x][y] = pair<int, int>(nx, ny);
    return;
  }
  if (in[nx][ny] == 1) {
    ed[x][y] = pair<int, int>(-1, -1);
    return;
  }
  if (ok[nx][ny] == 0) {
    in[nx][ny] = 1;
    ok[nx][ny] = 1;
    dfs(nx, ny, gr);
    in[nx][ny] = 0;
    ed[x][y] = ed[nx][ny];
  } else
    ed[x][y] = ed[nx][ny];
}
void print() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      cout << "(" << ed[i][j].first << "," << ed[i][j].second << "), ";
    cout << '\n';
  }
}
void buildblock() {
  int gr = 1;
  for (int i = n; i >= 1; i--) {
    if (g[gr + 1] == i) gr++;
    id[i] = gr;
    for (int j = 1; j <= m; j++)
      if (ok[i][j] == 0) {
        ok[i][j] = 1;
        in[i][j] = 1;
        dfs(i, j, gr);
        in[i][j] = 0;
      }
  }
}
void query() {
  int x, y;
  cin >> x >> y;
  while (!out(x, y) and (x, y) != (-1, -1)) {
    pair<int, int> nw = ed[x][y];
    x = nw.first;
    y = nw.second;
  }
  cout << x << " " << y << '\n';
}
void update() {
  int x, y;
  char c;
  cin >> x >> y >> c;
  if (c == '^')
    a[x][y] = 0;
  else if (c == '<')
    a[x][y] = 1;
  else
    a[x][y] = 2;
  int gg = id[x], r = g[gg + 1] + 1;
  for (int i = g[gg]; i >= r - 1; i--)
    for (int j = 0; j <= m + 1; j++) {
      ok[i][j] = 0;
      in[i][j] = 0;
    }
  for (int i = g[gg]; i >= r; i--) {
    for (int j = 1; j <= m; j++)
      if (ok[i][j] == 0) {
        ok[i][j] = 1;
        in[i][j] = 1;
        dfs(i, j, gg);
        in[i][j] = 0;
      };
  }
}
void solve() {
  for (int i = n; i >= 1; i -= k) g[++cnt] = i;
  buildblock();
  for (int i = 1; i <= q; i++) {
    char typ;
    cin >> typ;
    if (typ == 'A')
      query();
    else
      update();
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  input();
  solve();
  return 0;
}
