#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  long long _x = 0;
  int _ch = getchar(), _f = 1;
  for (; !isdigit(_ch) && (_ch != '-') && (_ch != EOF); _ch = getchar())
    ;
  if (_ch == '-') {
    _f = 0;
    _ch = getchar();
  }
  for (; isdigit(_ch); _ch = getchar()) _x = _x * 10 + _ch - '0';
  return _f ? _x : -_x;
}
void write(long long _x) {
  if (_x >= 10)
    write(_x / 10), putchar(_x % 10 + '0');
  else
    putchar(_x + '0');
}
inline void wrt(long long _x, char _p) {
  if (_x < 0) putchar('-'), _x = -_x;
  write(_x);
  if (_p) putchar(_p);
}
char a[100005][15];
int L[100005], R[100005];
pair<int, int> nx[100005][15];
int n, m, q, sn;
pair<int, int> go(int x, int y) {
  char ch = a[x][y];
  if (ch == '^')
    return make_pair(x - 1, y);
  else if (ch == '<')
    return make_pair(x, y - 1);
  else
    return make_pair(x, y + 1);
}
bool check(pair<int, int> x) {
  if (x.second < 1 || x.second > m) return 0;
  if (x.first < 1 || x.first > n) return 0;
  return 1;
}
void dfs(int x, int y) {
  if (nx[x][y] != make_pair(0, 0)) return;
  pair<int, int> to = go(x, y);
  if (to.first > R[x] || to.first < L[x] || (!check(to))) {
    nx[x][y] = to;
    return;
  }
  if (go(to.first, to.second) == make_pair(x, y)) {
    nx[x][y] = make_pair(-1, -1);
    nx[to.first][to.second] = make_pair(-1, -1);
  }
  dfs(to.first, to.second);
  nx[x][y] = nx[to.first][to.second];
}
void rebuild(int x) {
  for (int i = int(L[x]); i <= (int)(R[x]); i++)
    for (int j = int(1); j <= (int)(m); j++) nx[i][j] = make_pair(0, 0);
  for (int i = int(L[x]); i <= (int)(R[x]); i++)
    for (int j = int(1); j <= (int)(m); j++) dfs(i, j);
}
int main() {
  n = rd(), m = rd(), q = rd();
  sn = sqrt(n);
  for (int i = int(1); i <= (int)(n); i++) scanf("%s", a[i] + 1);
  for (int i = int(1); i <= (int)(n); i++)
    L[i] = (i - 1) / sn * sn + 1, R[i] = min(((i - 1) / sn + 1) * sn, n);
  for (int i = int(1); i <= (int)(n); i++)
    if (L[i] == i) rebuild(i);
  for (int i = int(1); i <= (int)(q); i++) {
    char ch = getchar();
    while (!(ch >= 'A' && ch <= 'Z')) ch = getchar();
    if (ch == 'A') {
      int x = rd(), y = rd();
      pair<int, int> res = make_pair(x, y);
      while (check(res)) res = nx[res.first][res.second];
      wrt(res.first, ' '), wrt(res.second, '\n');
    } else {
      int x = rd(), y = rd();
      char c = getchar();
      while (c != '^' && c != '<' && c != '>') c = getchar();
      a[x][y] = c;
      rebuild(x);
    }
  }
}
