#include <bits/stdc++.h>
using namespace std;
const int S = 320;
int N, M, Q;
char A[100002][12];
pair<int, int> W[100002][12];
void reset(int period) {
  int last = S * (period - 1);
  for (int i = last + 1; i <= min(N, last + S); ++i) {
    for (int j = 1; j <= M; ++j)
      if (A[i][j] == '^') {
        if (i == last + 1)
          W[i][j] = make_pair(i - 1, j);
        else
          W[i][j] = W[i - 1][j];
      }
    for (int j = 1; j <= M; ++j)
      if (A[i][j] == '<') {
        if (A[i][j - 1] == '>')
          W[i][j] = make_pair(-1, -1);
        else {
          if (j == 1)
            W[i][j] = make_pair(i, j - 1);
          else
            W[i][j] = W[i][j - 1];
        }
      }
    for (int j = M; j >= 1; --j)
      if (A[i][j] == '>') {
        if (A[i][j + 1] == '<')
          W[i][j] = make_pair(-1, -1);
        else {
          if (j == M)
            W[i][j] = make_pair(i, j + 1);
          else
            W[i][j] = W[i][j + 1];
        }
      }
  }
}
pair<int, int> trace(int x, int y) {
  if (x < 1 || y < 1 || x > N || y > M) return make_pair(x, y);
  return trace(W[x][y].first, W[x][y].second);
}
int main() {
  cin.sync_with_stdio(false);
  cin >> N >> M >> Q;
  for (int i = 1; i <= N; ++i) cin >> (A[i] + 1);
  for (int i = 1; (i - 1) * S + 1 <= N; ++i) reset(i);
  for (int i = 1; i <= Q; ++i) {
    char type;
    cin >> type;
    if (type == 'C') {
      int wx, wy;
      char wh;
      cin >> wx >> wy >> wh;
      A[wx][wy] = wh;
      reset((wx - 1) / S + 1);
    } else {
      int wx, wy;
      cin >> wx >> wy;
      auto result = trace(wx, wy);
      cout << result.first << ' ' << result.second << '\n';
    }
  }
}
