#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int M = 350;
const int P = 300;
int n, m, q;
char tp[5], c[5], mp[N][15];
int f[M][15], g[M][15];
int solve(int &x, int &y, int k) {
  while (y >= 1 && y <= m) {
    if (y > 1 && mp[x][y] == '<' && mp[x][y - 1] == '>' ||
        y < m && mp[x][y] == '>' && mp[x][y + 1] == '<')
      return -1;
    if (mp[x][y] == '<')
      y--;
    else if (mp[x][y] == '>')
      y++;
    else {
      x--;
      if (x <= k) break;
    }
  }
  if (x > k) return 1;
  return 0;
}
void walk(int x, int y) {
  int t = (x - 1) / P;
  int ans = solve(x, y, t * P);
  if (ans == -1) {
    printf("-1 -1\n");
    return;
  } else if (ans == 1) {
    printf("%d %d\n", x, y);
    return;
  } else {
    for (int i = t; i >= 1; i--) {
      if (g[i][y] == -1) {
        printf("-1 -1\n");
        return;
      } else if (g[i][y] == 1) {
        solve(x, y, (i - 1) * P);
        printf("%d %d\n", x, y);
        return;
      } else {
        x -= P;
        y = f[i][y];
      }
    }
  }
  printf("%d %d\n", x, y);
}
void modify(int t) {
  if (t * P > n) return;
  int x, y;
  for (int i = 1; i <= m; i++) {
    x = t * P;
    y = i;
    g[t][i] = solve(x, y, (t - 1) * P);
    f[t][i] = y;
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) scanf("%s", mp[i] + 1);
  int t = (n - 1) / P;
  for (int i = t; i >= 1; i--) modify(i);
  for (int i = 1; i <= q; i++) {
    int x, y;
    scanf("%s%d%d", tp, &x, &y);
    if (tp[0] == 'A') {
      walk(x, y);
    } else {
      scanf("%s", c);
      mp[x][y] = c[0];
      modify((x - 1) / P + 1);
    }
  }
  return 0;
}
