#include <bits/stdc++.h>
using namespace std;
void update(vector<string>& table, vector<vector<pair<int, int>*> >& results,
            int i, int j) {
  int n = table.size();
  int m = table[0].size();
  if ((i < n - 1) && (table[i + 1][j] == '^') &&
      (results[i][j] != results[i + 1][j])) {
    results[i + 1][j] = results[i][j];
    update(table, results, i + 1, j);
  }
  if ((j < m - 1) && (table[i][j + 1] == '<') &&
      (results[i][j] != results[i][j + 1])) {
    results[i][j + 1] = results[i][j];
    update(table, results, i, j + 1);
  }
  if ((j > 0) && (table[i][j - 1] == '>') &&
      (results[i][j] != results[i][j - 1])) {
    results[i][j - 1] = results[i][j];
    update(table, results, i, j - 1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, q;
  cin >> n >> m >> q;
  vector<string> table(n);
  for (int i = 0; i < n; ++i) {
    cin >> table[i];
  }
  vector<vector<pair<int, int>*> > results(n);
  for (int i = 0; i < n; ++i) {
    results[i] = vector<pair<int, int>*>(m);
  }
  vector<pair<int, int> > left(n);
  vector<pair<int, int> > right(n);
  vector<pair<int, int> > top(m);
  pair<int, int> cyclic = make_pair(-1, -1);
  for (int i = 0; i < n; ++i) {
    left[i] = make_pair(i + 1, 0);
    right[i] = make_pair(i + 1, m + 1);
    if (table[i][0] == '<') {
      results[i][0] = &left[i];
      update(table, results, i, 0);
    }
    if (table[i][m - 1] == '>') {
      results[i][m - 1] = &right[i];
      update(table, results, i, m - 1);
    }
  }
  for (int j = 0; j < m; ++j) {
    top[j] = make_pair(0, j + 1);
    if (table[0][j] == '^') {
      results[0][j] = &top[j];
      update(table, results, 0, j);
    }
  }
  char a;
  int x, y;
  for (int j = 0; j < q; ++j) {
    cin >> a >> x >> y;
    x--;
    y--;
    if (a == 'A') {
      if (results[x][y] == NULL) {
        cout << -1 << " " << -1 << endl;
      } else {
        cout << results[x][y]->first << " " << results[x][y]->second << endl;
      }
    } else {
      cin >> a;
      table[x][y] = a;
      if (a == '^') {
        if (x == 0) {
          results[x][y] = &top[y];
          update(table, results, x, y);
        } else {
          if (results[x - 1][y] == NULL) {
            if (results[x][y] != NULL) {
              results[x][y] = results[x - 1][y];
              update(table, results, x, y);
            }
          } else {
            results[x][y] = results[x - 1][y];
            update(table, results, x, y);
          }
        }
      } else if (a == '>') {
        if (y == m - 1) {
          results[x][y] = &right[x];
          update(table, results, x, y);
        } else {
          if (results[x][y + 1] == NULL) {
            if (results[x][y] != NULL) {
              results[x][y] = results[x][y + 1];
              update(table, results, x, y);
            }
          } else {
            if (table[x][y + 1] != '<') {
              results[x][y] = results[x][y + 1];
              update(table, results, x, y);
            } else {
              results[x][y] = NULL;
              update(table, results, x, y);
            }
          }
        }
      } else if (a == '<') {
        if (y == 0) {
          results[x][y] = &left[x];
          update(table, results, x, y);
        } else {
          if (results[x][y - 1] == NULL) {
            if (results[x][y] != NULL) {
              results[x][y] = results[x][y - 1];
              update(table, results, x, y);
            }
          } else {
            if (table[x][y - 1] != '>') {
              results[x][y] = results[x][y - 1];
              update(table, results, x, y);
            } else {
              results[x][y] = NULL;
              update(table, results, x, y);
            }
          }
        }
      }
    }
  }
  return 0;
}
