#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1000, M = 20;
const int sqt = 318;
int n, m, q;
pair<int, int> nex[N][M];
string s[N];
void dfs(int x, int y) {
  if (s[x][y] == '^') {
    if (x == 0 || (x - 1) / sqt < x / sqt)
      nex[x][y] = {x, y};
    else
      nex[x][y] = nex[x - 1][y];
    return;
  }
  if (s[x][y] == '<') {
    if (y == 0)
      nex[x][y] = {x, y};
    else if (s[x][y - 1] == '>')
      nex[x][y] = {x, y - 1};
    else
      nex[x][y] = nex[x][y - 1];
    return;
  }
  if (y == m - 1) {
    nex[x][y] = {x, y};
    return;
  }
  dfs(x, y + 1);
  if (s[x][y + 1] == '<')
    nex[x][y] = {x, y + 1};
  else
    nex[x][y] = nex[x][y + 1];
}
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (int j = 0; j < m; j++) dfs(i, j);
  }
  while (q--) {
    char ty, c;
    int x, y;
    cin >> ty;
    scanf("%d%d", &x, &y);
    x--, y--;
    if (ty == 'C') {
      cin >> c;
      s[x][y] = c;
      int i = x;
      do {
        for (int j = 0; j < m; j++) dfs(i, j);
        i++;
      } while (i < n && i % sqt);
    } else {
      int cnt = m * sqt;
      while (x < n && x >= 0 && y < m && y >= 0 && cnt >= 0) {
        if (nex[x][y].first != x || nex[x][y].second != y) {
          pair<int, int> p = nex[x][y];
          x = p.first;
          y = p.second;
        } else {
          if (s[x][y] == '^')
            x--;
          else if (s[x][y] == '>')
            y++;
          else
            y--;
        }
        cnt--;
      }
      if (cnt == -112) continue;
      if (x >= n || x < 0 || y < 0 || y >= m)
        printf("%d %d\n", x + 1, y + 1);
      else
        printf("-1 -1\n");
    }
  }
  return 0;
}
