#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 100 + 10, SQ = 300;
char c[MAXN][20];
pair<int, int> w[MAXN][20];
int mark[MAXN][20];
int n, m, q, cnt = 1;
bool ok(int l, int r, int x, int y) {
  if (l <= x && x < r && 0 <= y && y < m) return true;
  return false;
}
pair<int, int> get(int l, int r, int x, int y) {
  if (!ok(l, r, x, y)) return {x, y};
  if (mark[x][y] == cnt)
    return {-2, -2};
  else if (mark[x][y])
    return w[x][y];
  mark[x][y] = cnt;
  int new_x = x, new_y = y;
  if (c[x][y] == '^')
    new_x--;
  else if (c[x][y] == '>')
    new_y++;
  else
    new_y--;
  return w[x][y] = get(l, r, new_x, new_y);
}
void upd(int ind) {
  int l = ind * SQ, r = min(n, l + SQ);
  for (int i = l; i < r; i++)
    for (int j = 0; j < m; j++) mark[i][j] = 0;
  cnt = 1;
  for (int i = l; i < r; i++)
    for (int j = 0; j < m; j++)
      if (!mark[i][j]) w[i][j] = get(l, r, i, j), cnt++;
}
pair<int, int> where(int x, int y) {
  if (x < 0 || y < 0 || x >= n || y >= m) return {x, y};
  return where(w[x][y].first, w[x][y].second);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> c[i][j];
  for (int i = 0; i < (n - 1) / SQ + 1; i++) upd(i);
  while (q--) {
    char ty;
    int x, y;
    cin >> ty >> x >> y;
    x--, y--;
    if (ty == 'A') {
      pair<int, int> ans = where(x, y);
      cout << ans.first + 1 << " " << ans.second + 1 << endl;
    } else {
      cin >> c[x][y];
      upd(x / SQ);
    }
  }
  return 0;
}
