#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 1e9 + 1;
const long long INF64 = 1e18;
const double EPS = 1e-9;
const double PI = acos(-1);
const long long MD = 1551513443;
const long long T = 25923;
const int N = 100100;
const int M = 2000;
int n, m, qq, k;
string s[N];
pair<pair<int, char>, pair<int, int> > q[N];
bool use[N][11], mark[N][11], ex_ok[N * 11];
int color[N][11];
pair<int, int> ex[N * 11];
void build_graph() {
  for (int i = 0; i < int(N); i++)
    for (int j = 0; j < int(11); j++) {
      mark[i][j] = 0;
      color[i][j] = -1;
    }
  k = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      if (use[i][j]) {
        ex[k] = make_pair(INF, INF);
        ex_ok[k] = 0;
        color[i][j] = k++;
      } else if (s[i][j] == '^') {
        if (i == 1 || use[i - 1][j]) {
          ex[k] = make_pair(INF, INF);
          ex_ok[k] = 0;
          color[i][j] = k;
          if (i == 1) ex_ok[k] = 1;
          ex[k] = make_pair(i - 1, j);
          k++;
        } else {
          color[i][j] = color[i - 1][j];
        }
        int jj = j - 1;
        while (jj >= 1 && s[i][jj] == '>' && !use[i][jj]) {
          color[i][jj] = color[i][j];
          jj--;
        }
        jj = j + 1;
        while (jj <= m && s[i][jj] == '<' && !use[i][jj]) {
          color[i][jj] = color[i][j];
          jj++;
        }
      }
    for (int j = 1; j <= m; j++)
      if (color[i][j] == -1) {
        if (s[i][j] == '<') {
          if (j == 1 || use[i][j - 1]) {
            ex[k] = make_pair(INF, INF);
            ex_ok[k] = 0;
            color[i][j] = k;
            if (j == 1) ex_ok[k] = 1;
            ex[k] = make_pair(i, j - 1);
            k++;
          } else {
            color[i][j] = color[i][j - 1];
          }
        } else if (s[i][j] == '>') {
          if (j == 1 || use[i][j - 1] || s[i][j - 1] != '>') {
            ex[k] = make_pair(INF, INF);
            ex_ok[k] = 0;
            color[i][j] = k;
            k++;
          } else
            color[i][j] = color[i][j - 1];
          if (j == m || use[i][j + 1]) {
            if (j == m) ex_ok[color[i][j]] = 1;
            ex[color[i][j]] = make_pair(i, j + 1);
          }
        }
      }
  }
}
int mark1[N * 11], k1;
pair<int, int> dfs1(int first, int second) {
  if (first < 1 || first > n || second < 1 || second > m)
    return make_pair(first, second);
  int k = color[first][second];
  if (mark1[k] == k1) return make_pair(-1, -1);
  mark1[k] = k1;
  if (use[first][second]) {
    int xx = first, yy = second;
    if (s[first][second] == '<')
      yy--;
    else if (s[first][second] == '^')
      xx--;
    else
      yy++;
    return dfs1(xx, yy);
  } else {
    if (ex_ok[k] || ex[k].first == INF) {
      return ex[k];
    }
    return dfs1(ex[k].first, ex[k].second);
  }
}
pair<int, int> solve(int first, int second) {
  k1++;
  pair<int, int> ans = dfs1(first, second);
  if (ans.first == INF) ans.first = ans.second = -1;
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> qq;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    s[i] = " " + s[i];
  }
  for (int i = 0; i < int(qq); i++) {
    string s;
    cin >> s;
    if (s == "A") {
      int first, second;
      cin >> first >> second;
      q[i].first.first = 1;
      q[i].second = make_pair(first, second);
    } else {
      int first, second;
      cin >> first >> second >> s;
      q[i].first.first = 2;
      q[i].first.second = s[0];
      q[i].second = make_pair(first, second);
    }
  }
  for (int i = 0; i < int(qq); i++) {
    int j = i;
    for (int i = 0; i < int(N); i++)
      for (int j = 0; j < int(11); j++) use[i][j] = 0;
    while (j < qq && j - i < M) {
      if (q[j].first.first == 2) use[q[j].second.first][q[j].second.second] = 1;
      j++;
    }
    build_graph();
    for (int u = i; u < j; u++) {
      if (q[u].first.first == 1) {
        pair<int, int> ans = solve(q[u].second.first, q[u].second.second);
        cout << ans.first << ' ' << ans.second << endl;
      } else
        s[q[u].second.first][q[u].second.second] = q[u].first.second;
    }
    i = j - 1;
  }
  return 0;
}
