#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
const int sq = 420;
int dx[3] = {0, -1, 0}, dy[3] = {-1, 0, 1}, a[maxn][13], n, m, q,
    seen[maxn][13];
pair<int, int> rage[maxn][13];
inline int get(char ch) {
  if (ch == '<') return 0;
  if (ch == '^') return 1;
  return 2;
}
inline bool out(int x, int y) {
  if (x == 0 or y == 0 or x == n + 1 or y == m + 1) return 1;
  return 0;
}
pair<int, int> dfs(int x, int y, int cur) {
  if (x / sq != cur or out(x, y)) return make_pair(x, y);
  seen[x][y] = 1;
  int nx = x + dx[a[x][y]];
  int ny = y + dy[a[x][y]];
  if (seen[nx][ny] and nx / sq == cur) {
    rage[x][y] = rage[nx][ny];
  } else
    rage[x][y] = dfs(nx, ny, cur);
  return rage[x][y];
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m >> q;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < m + 1; j++) {
      char ch;
      cin >> ch;
      a[i][j] = get(ch);
    }
  int co = 0;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < m + 1; j++)
      if (!seen[i][j]) dfs(i, j, i / sq);
  for (int p = 0; p < q; p++) {
    char ch;
    cin >> ch;
    if (ch == 'A') {
      co++;
      int x, y;
      cin >> x >> y;
      while (!out(x, y)) {
        pair<int, int> pi = rage[x][y];
        x = pi.first;
        y = pi.second;
      }
      if (x == 0 and y == 0)
        cout << -1 << ' ' << -1 << "\n";
      else
        cout << x << ' ' << y << "\n";
    } else {
      int x, y;
      char ch2;
      cin >> x >> y >> ch2;
      a[x][y] = get(ch2);
      x = x / sq;
      x *= sq;
      int x2 = x + sq;
      x2 = min(x2, n + 1);
      x = max(x, 1);
      for (int i = x; i < x2; i++) {
        for (int j = 0; j < m + 2; j++) {
          seen[i][j] = 0;
          rage[i][j] = make_pair(0, 0);
        }
      }
      for (int i = x; i < x2; i++)
        for (int j = 1; j < m + 1; j++) {
          if (!seen[i][j]) dfs(i, j, i / sq);
        }
    }
  }
  return 0;
}
