#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAGIC = 2000;
int block(int x) { return x / MAGIC + bool(x % MAGIC); }
int n, m, q;
char maze[100000 + 10][11], v[100000 + 10][11];
pair<int, int> res[100000 + 10][11];
pair<int, int> dfs(int x, int y) {
  if (x == 0 || y == 0 || y == m + 1) {
    return make_pair(x, y);
  }
  if (v[x][y]) return res[x][y];
  v[x][y] = 1;
  if (maze[x][y] == '>') {
    if (y + 1 != m + 1 && maze[x][y + 1] == '<') {
      return res[x][y] = make_pair(x, y);
    }
    return res[x][y] = dfs(x, y + 1);
  }
  if (maze[x][y] == '<') {
    if (y - 1 != 0 && maze[x][y - 1] == '>') {
      return res[x][y] = make_pair(x, y);
    }
    return res[x][y] = dfs(x, y - 1);
  }
  if (maze[x][y] == '^') {
    if (x - 1 != 0)
      if (block(x) != block(x - 1)) {
        return res[x][y] = make_pair(x - 1, y);
      }
    return res[x][y] = dfs(x - 1, y);
  }
  return make_pair(1, 1);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cin >> maze[i][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) dfs(i, j);
  for (int Q = 1; Q <= q; ++Q) {
    char cp;
    cin >> cp;
    if (cp == 'C') {
      int x, y;
      char c;
      cin >> x >> y >> c;
      int BLOCK = block(x);
      maze[x][y] = c;
      int S, T;
      S = (BLOCK - 1) * MAGIC + 1;
      T = BLOCK * MAGIC;
      T = min(T, n);
      for (int i = S; i <= T; ++i)
        for (int j = 1; j <= m; ++j) v[i][j] = 0;
      for (int i = S; i <= T; ++i)
        for (int j = 1; j <= m; ++j) dfs(i, j);
    } else {
      int x, y;
      cin >> x >> y;
      pair<int, int> now = res[x][y];
      int las = block(now.first) + 1;
      while (block(now.first) == las - 1 && now.first && now.second &&
             now.second != m + 1) {
        las = block(now.first);
        now = res[now.first][now.second];
      }
      if (!now.first || !now.second || now.second == m + 1) {
        cout << now.first << " " << now.second << endl;
      } else {
        cout << -1 << " " << -1 << endl;
      }
    }
  }
  return 0;
}
