#include <bits/stdc++.h>
using namespace std;
const int N = 100005, M = 15, BCKTS = 300, BCKT_SZ = N / BCKTS + 2;
int n, m;
char grid[N][M];
pair<int, int> outside_bucket[N][M];
int bckt_id[N];
int mark[N][M];
bool in_loop[N][M];
inline bool inside(int r, int c) { return r >= 0 && c >= 0 && r < n && c < m; }
pair<pair<int, int>, bool> dfs(int r, int c, int initial_bucket) {
  if (!inside(r, c)) return make_pair(pair<int, int>(r, c), false);
  if (bckt_id[r] != initial_bucket)
    return make_pair(pair<int, int>(r, c), false);
  if (mark[r][c] == 1 || in_loop[r][c])
    return make_pair(pair<int, int>(r, c), true);
  if (mark[r][c] == 2) return make_pair(outside_bucket[r][c], false);
  mark[r][c] = 1;
  pair<pair<int, int>, bool> ret;
  if (grid[r][c] == '>') {
    ret = dfs(r, c + 1, initial_bucket);
  } else if (grid[r][c] == '<') {
    ret = dfs(r, c - 1, initial_bucket);
  } else {
    ret = dfs(r - 1, c, initial_bucket);
  }
  mark[r][c] = 2;
  if (ret.second) {
    in_loop[r][c] = true;
    return ret;
  } else {
    outside_bucket[r][c] = ret.first;
    return ret;
  }
}
void build() {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      dfs(i, j, bckt_id[i]);
    }
  }
}
pair<int, int> query(int r, int c) {
  pair<int, int> ret = pair<int, int>(r, c);
  while (inside(ret.first, ret.second)) {
    if (in_loop[ret.first][ret.second]) return pair<int, int>(-1, -1);
    ret = outside_bucket[ret.first][ret.second];
  }
  ret.first += 1;
  ret.second += 1;
  return ret;
}
void update(int r, int c, char new_char) {
  int id = bckt_id[r];
  int start = id * BCKT_SZ, end = min(n, (id + 1) * BCKT_SZ);
  for (int i = start; i <= end; ++i) {
    for (int j = 0; j < m; ++j) {
      mark[i][j] = 0;
      in_loop[i][j] = false;
    }
  }
  grid[r][c] = new_char;
  for (int i = start; i <= end; ++i) {
    for (int j = 0; j < m; ++j) {
      dfs(i, j, bckt_id[i]);
    }
  }
}
int main() {
  int q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < n; ++i) {
    scanf("%s", grid[i]);
    bckt_id[i] = i / BCKT_SZ;
  }
  build();
  while (q-- > 0) {
    char type;
    int r, c;
    scanf(" %c %d %d", &type, &r, &c);
    --r;
    --c;
    if (type == 'A') {
      pair<int, int> ans = query(r, c);
      printf("%d %d\n", ans.first, ans.second);
    } else {
      char new_char;
      scanf(" %c", &new_char);
      update(r, c, new_char);
    }
  }
  return 0;
}
