#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 123456;
const long long MAXM = 12;
const long long SQRT = 345;
long long n, m;
pair<long long, long long> nxt[MAXN][MAXM];
string tab[MAXN];
void calc(long long x) {
  long long l = x * SQRT, r = min(n, (x + 1) * SQRT);
  for (long long i = l; i < r; ++i) {
    bool mark[MAXM] = {};
    for (long long k = 0; k < m; ++k)
      if (tab[i][k] == '^') {
        if (!i)
          nxt[i][k] = {i, k};
        else if (i == l)
          nxt[i][k] = {i - 1, k};
        else
          nxt[i][k] = nxt[i - 1][k];
        mark[k] = true;
        long long p;
        p = k + 1;
        while (p < m && tab[i][p] == '<') {
          nxt[i][p] = nxt[i][k], mark[p] = true;
          p++;
        }
        p = k - 1;
        while (p >= 0 && tab[i][p] == '>') {
          nxt[i][p] = nxt[i][k], mark[p] = true;
          p--;
        }
      }
    long long k;
    k = 0;
    while (k < m && tab[i][k] == '<') {
      nxt[i][k] = {i, 0};
      mark[k] = true;
      k++;
    }
    k = m - 1;
    while (k >= 0 && tab[i][k] == '>') {
      nxt[i][k] = {i, m - 1};
      mark[k] = true;
      k--;
    }
    for (k = 0; k < m; ++k)
      if (!mark[k]) nxt[i][k] = {-2, -2};
  }
}
bool tend(long long x, long long y) {
  if (nxt[x][y].first == x && nxt[x][y].second == y) return true;
  if (nxt[x][y].first == -2 && nxt[x][y].second == -2) return true;
  return false;
}
void ask(long long x, long long y) {
  while (!tend(x, y)) {
    long long nx = nxt[x][y].first;
    long long ny = nxt[x][y].second;
    x = nx;
    y = ny;
  }
  if (nxt[x][y].first == -2)
    cout << "-1 -1\n";
  else
    cout << nxt[x][y].first + 1 + (tab[x][y] == '^' ? -1 : 0) << " "
         << nxt[x][y].second + 1 +
                (tab[x][y] == '<' ? -1 : (tab[x][y] == '>' ? 1 : 0))
         << "\n";
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long q;
  cin >> n >> m >> q;
  for (long long i = 0; i < n; ++i) cin >> tab[i];
  for (long long i = 0; i <= (n - 1) / SQRT; ++i) calc(i);
  while (q--) {
    long long x, y;
    char t;
    cin >> t >> x >> y;
    x--, y--;
    if (t == 'C') {
      char c;
      cin >> c;
      tab[x][y] = c;
      calc(x / SQRT);
    } else
      ask(x, y);
  }
  return 0;
}
