#include <bits/stdc++.h>
using namespace std;
const int N = 100 * 1000 + 10, M = 10 + 10, second = 300;
char a[N][M];
pair<int, int> nxt[N][M];
int n, m;
void upd(int i) {
  for (int j = (1); j <= (m); j++) {
    pair<int, int> p(i, j);
    int t = 0;
    while (true) {
      if (a[p.first][p.second] == '<')
        p.second--;
      else if (a[p.first][p.second] == '>')
        p.second++;
      if (p.second == 0 || p.second == m + 1) break;
      if (a[p.first][p.second] == '^') {
        p.first--;
        if (p.first > 0 && p.first >= i / second * second + 1)
          p = nxt[p.first][p.second];
        break;
      }
      t++;
      if (t > 20) {
        p = {-1, -1};
        break;
      }
    }
    nxt[i][j] = p;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int q;
  cin >> n >> m >> q;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) cin >> a[i][j];
  for (int i = (1); i <= (n); i++) upd(i);
  while (q--) {
    char t;
    int x, y;
    cin >> t >> x >> y;
    if (t == 'A') {
      pair<int, int> p(x, y);
      while (p.first > 0 && p.second > 0 && p.first <= n && p.second <= m)
        p = nxt[p.first][p.second];
      cout << p.first << " " << p.second << '\n';
    } else {
      char c;
      cin >> c;
      a[x][y] = c;
      for (int i = (x); i <= (min(x / second * second + second, n)); i++)
        upd(i);
    }
  }
  return 0;
}
