#include <bits/stdc++.h>
using namespace std;
string arr[102400];
pair<int, int> dp[102400][16];
int n, m;
void build(int lp, int rp) {
  for (int i = lp; i <= rp; i++) {
    for (int j = 0; j < m; j++) dp[i][j] = make_pair(i, j);
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == '^')
        dp[i][j] = i == lp ? make_pair(i - 1, j) : dp[i - 1][j];
    }
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == '<')
        dp[i][j] = j == 0 ? make_pair(i, j - 1) : dp[i][j - 1];
    }
    for (int j = m - 1; j >= 0; j--) {
      if (arr[i][j] == '>')
        dp[i][j] = j == m - 1 ? make_pair(i, j + 1) : dp[i][j + 1];
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  int q;
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i += 256) {
    build(i, min(n - 1, i + 256 - 1));
  }
  while (q--) {
    char c;
    int x, y;
    cin >> c >> x >> y;
    x--;
    y--;
    if (c == 'A') {
      int nr, nc;
      while ((x >= 0 && x < n) && (y >= 0 && y < m)) {
        nr = dp[x][y].first;
        nc = dp[x][y].second;
        if (x == nr && (nc >= 0 && nc < m)) {
          x = nr;
          y = nc;
          break;
        }
        x = nr;
        y = nc;
      }
      if ((x >= 0 && x < n) && (y >= 0 && y < m))
        cout << "-1 -1" << endl;
      else
        cout << x + 1 << " " << y + 1 << endl;
    } else {
      cin >> arr[x][y];
      build(x / 256 * 256, min(n - 1, x / 256 * 256 + 256 - 1));
    }
  }
  return 0;
}
