#include <bits/stdc++.h>
using namespace std;
pair<int, int> nxt[100009][19];
char a[100009][19];
pair<int, int> ad(char c) {
  if (c == '^') return {-1, 0};
  if (c == '<') return {0, -1};
  return {0, 1};
}
pair<int, int> rad(char c) { return {ad(c).first * (-1), ad(c).second * (-1)}; }
int sqq;
int vis[100009][19];
int n, m, q;
void con(int x, int y, int cx, int cy) {
  if (cx / 330 == x / 330) {
    nxt[x][y] = nxt[cx][cy];
  } else {
    nxt[x][y] = {cx, cy};
  }
}
void dfss(int x, int y) {
  if (x <= 0 || y <= 0 || x > n || y > m) {
    cout << x << " " << y << "\n";
    return;
  }
  dfss(nxt[x][y].first, nxt[x][y].second);
}
int las = 1;
void rdfs(int x, int y) {
  if (vis[x][y] == las) return;
  vis[x][y] = las;
  if (x / 330 != sqq) return;
  if (a[x + 1][y] == '^') {
    con(x + 1, y, x, y);
    rdfs(x + 1, y);
  }
  if (a[x][y - 1] == '>') {
    con(x, y - 1, x, y);
    rdfs(x, y - 1);
  }
  if (a[x][y + 1] == '<') {
    con(x, y + 1, x, y);
    rdfs(x, y + 1);
  }
}
void dfs(int x, int y) {
  if (vis[x][y]) return;
  vis[x][y] = 1;
  if (a[x][y] == '.') {
    nxt[x][y] = {x, y};
    return;
  }
  if (a[x][y] == '>' && a[x][y + 1] == '<') {
    nxt[x][y] = {-1, -1};
    return;
  }
  if (a[x][y] == '<' && a[x][y - 1] == '>') {
    nxt[x][y] = {-1, -1};
    return;
  }
  pair<int, int> sm = ad(a[x][y]);
  dfs(x + sm.first, y + sm.second);
  con(x, y, x + sm.first, y + sm.second);
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> q;
  for (int i = 0; i <= n + 1; i++) {
    for (int j = 0; j <= m + 1; j++) a[i][j] = '.';
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      dfs(i, j);
    }
  }
  char o;
  int x, y;
  while (q--) {
    cin >> o >> x >> y;
    if (o == 'A') {
      dfss(x, y);
    } else {
      las++;
      cin >> o;
      vis[x][y] = 0;
      a[x][y] = o;
      dfs(x, y);
      sqq = x / 330;
      rdfs(x, y);
    }
  }
}
