#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7, magic = 320;
int n, m, q, in_block[N], l[500], r[500];
bool vis[N][12];
pair<int, int> ret[N][12];
string board[N], op;
void update(int block) {
  for (int i = l[block]; i <= r[block]; i++) {
    queue<pair<int, int> > q;
    for (int j = 0; j < m; j++) {
      if (board[i][j] == '>') {
        q.push(make_pair(i, j));
      } else if (board[i][j] == '^') {
        if (i == l[block]) {
          ret[i][j] = make_pair(i - 1, j);
        } else
          ret[i][j] = ret[i - 1][j];
        while (!q.empty()) {
          int x = q.front().first, y = q.front().second;
          q.pop();
          ret[x][y] = ret[i][j];
        }
      } else {
        if (j == 0) {
          ret[i][j] = make_pair(i, j - 1);
        } else if (board[i][j - 1] == '>') {
          ret[i][j] = make_pair(-1, -1);
          while (!q.empty()) {
            int x = q.front().first, y = q.front().second;
            q.pop();
            ret[x][y] = ret[i][j];
          }
        } else
          ret[i][j] = ret[i][j - 1];
      }
    }
    while (!q.empty()) {
      int x = q.front().first, y = q.front().second;
      q.pop();
      ret[x][y] = make_pair(i, m);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    cin >> board[i];
  }
  for (int i = 0; i < 500; i++) l[i] = -1;
  int mxblock = 0;
  for (int i = 0; i < n; i++) {
    in_block[i] = i / magic;
    if (l[in_block[i]] == -1) l[in_block[i]] = i;
    r[in_block[i]] = i;
    mxblock = max(mxblock, in_block[i]);
  }
  for (int block = 0; block <= mxblock; block++) {
    update(block);
  }
  while (q--) {
    int x, y;
    cin >> op >> x >> y;
    x--, y--;
    if (op[0] == 'C') {
      cin >> op;
      board[x][y] = op[0];
      update(in_block[x]);
    } else {
      while (x >= 0 && y >= 0 && x < n && y < m) {
        int sx = x;
        x = ret[x][y].first;
        y = ret[sx][y].second;
      }
      if (x == -1 && y == -1)
        x = x;
      else
        x++, y++;
      cout << x << " " << y << "\n";
    }
  }
}
