#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 10, maxm = 12, SQ = 317, INF = 1000000000;
int n, m, q, x, y, save;
pair<int, int> ja[maxn][maxm];
char table[maxn][maxm], type, to;
bool mark[maxn][maxm];
void dfs(int a, int b) {
  mark[a][b] = 1;
  if ((a == 0 || a / SQ > (a - 1) / SQ) && table[a][b] == '^')
    ja[a][b] = make_pair(a - 1, b);
  else if (b == 0 && table[a][b] == '<')
    ja[a][b] = make_pair(a, b - 1);
  else if (b == m - 1 && table[a][b] == '>')
    ja[a][b] = make_pair(a, b + 1);
  else if ((table[a][b] == '<' && table[a][b - 1] == '>') ||
           (table[a][b] == '>' && table[a][b + 1] == '<'))
    ja[a][b] = make_pair(-INF, -INF);
  else {
    if (table[a][b] == '>') {
      if (!mark[a][b + 1]) dfs(a, b + 1);
      ja[a][b] = ja[a][b + 1];
    } else if (table[a][b] == '<')
      ja[a][b] = ja[a][b - 1];
    else
      ja[a][b] = ja[a - 1][b];
  }
}
void dfsu(int a, int b) {
  if (table[a][b] == '<') {
    ja[a][b] = ja[a][b - 1];
    if (b < m && table[a][b + 1] == '<') dfsu(a, b + 1);
  } else if (table[a][b] == '>') {
    ja[a][b] = ja[a][b + 1];
    if (b > 0 && table[a][b - 1] == '>') dfsu(a, b - 1);
  } else {
    ja[a][b] = ja[a - 1][b];
    if (b < m && table[a][b + 1] == '<') dfsu(a, b + 1);
    if (b > 0 && table[a][b - 1] == '>') dfsu(a, b - 1);
  }
  if (a < n && table[a + 1][b] == '^' && (a + 1) / SQ == a / SQ) dfsu(a + 1, b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> table[i][j];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!mark[i][j]) dfs(i, j);
    }
  }
  for (int i = 0; i < q; i++) {
    cin >> type;
    if (type == 'A') {
      cin >> x >> y;
      x--;
      y--;
      while (x >= 0 && x < n && y >= 0 && y < m) {
        save = x;
        x = ja[save][y].first;
        y = ja[save][y].second;
      }
      if (x == -INF)
        cout << -1 << " " << -1 << endl;
      else
        cout << x + 1 << " " << y + 1 << endl;
    } else {
      cin >> x >> y >> to;
      x--;
      y--;
      table[x][y] = to;
      if ((x == 0 || x / SQ > (x - 1) / SQ) && table[x][y] == '^')
        ja[x][y] = make_pair(x - 1, y);
      else if (y == 0 && table[x][y] == '<')
        ja[x][y] = make_pair(x, y - 1);
      else if (y == m - 1 && table[x][y] == '>')
        ja[x][y] = make_pair(x, y + 1);
      else if ((table[x][y] == '<' && table[x][y - 1] == '>') ||
               (table[x][y] == '>' && table[x][y + 1] == '<'))
        ja[x][y] = make_pair(-INF, -INF);
      else {
        if (table[x][y] == '>')
          ja[x][y] = ja[x][y + 1];
        else if (table[x][y] == '<')
          ja[x][y] = ja[x][y - 1];
        else
          ja[x][y] = ja[x - 1][y];
      }
      if (x < n && table[x + 1][y] == '^' && (x + 1) / SQ == x / SQ)
        dfsu(x + 1, y);
      if (y > 0 && table[x][y - 1] == '>') dfsu(x, y - 1);
      if (y < m && table[x][y + 1] == '<') dfsu(x, y + 1);
    }
  }
  return 0;
}
