#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265359;
const int maxn = 2e5 + 7;
const int mod = 1e9 + 7;
const long long INF = 9223372036854775807;
const int inf = 2e9 + 7;
const int sq = 333;
int n, m, q;
int indx;
char c[maxn][12];
pair<int, int> nxt[maxn][12];
bool mark[maxn][12];
pair<int, int> ret;
void dfs(int x, int y) {
  if (x / sq != indx || (x < 0 || x >= n) || (y >= m || y < 0)) {
    ret = {x, y};
    return;
  }
  if (y > 0 && c[x][y] == '<' && c[x][y - 1] == '>')
    mark[x][y - 1] = mark[x][y] = 1, nxt[x][y] = nxt[x][y - 1] = {x, y};
  if (c[x][y] == '>' && c[x][y + 1] == '<')
    mark[x][y + 1] = mark[x][y] = 1, nxt[x][y] = nxt[x][y + 1] = {x, y};
  if (mark[x][y]) {
    ret = nxt[x][y];
    return;
  }
  mark[x][y] = 1;
  if (c[x][y] == '^') dfs(x - 1, y), nxt[x][y] = ret;
  if (c[x][y] == '<') dfs(x, y - 1), nxt[x][y] = ret;
  if (c[x][y] == '>') dfs(x, y + 1), nxt[x][y] = ret;
}
int sx, sy, ex, ey;
void update(int x) {
  indx = x;
  sx = x * sq, ex = min(n, x * sq + sq);
  for (int i = sx; i < ex; i++)
    for (int j = 0; j < m; j++) mark[i][j] = 0;
  for (int i = sx; i < ex; i++)
    for (int j = 0; j < m; j++)
      if (!mark[i][j]) dfs(i, j);
}
int xx, yy;
void solve(int x, int y) {
  while (1) {
    if (x < 0 || y >= m || y < 0) {
      cout << x + 1 << " " << y + 1 << endl;
      return;
    }
    pair<int, int> k = {x, y};
    if (x >= n || nxt[x][y] == k) {
      cout << -1 << " " << -1 << endl;
      return;
    }
    xx = nxt[x][y].first;
    yy = nxt[x][y].second;
    x = xx, y = yy;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  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; i++)
    for (int j = 0; j < m; j++)
      if (!mark[i][j]) indx = i / sq, dfs(i, j);
  char t;
  while (q--) {
    int x, y;
    cin >> t >> x >> y;
    x--, y--;
    if (t == 'C') {
      cin >> t;
      c[x][y] = t;
      update(x / sq);
    } else {
      solve(x, y);
    }
  }
}
