#include <bits/stdc++.h>
using namespace std;
using cd = complex<double>;
const int Inf = 1000000007;
const long long mod = 1000000007;
const double Pi = acos(-1);
void Fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int n, m, q;
int bl = 300;
char a[100005][11];
pair<int, int> P[100005][11];
pair<int, int> Update(int x, int y) {
  if (P[x][y] != make_pair(0, 0)) {
    return P[x][y];
  }
  if (a[x][y] == '^') {
    if (x % bl == 1) {
      return P[x][y] = make_pair(x, y);
    } else {
      return P[x][y] = Update(x - 1, y);
    }
  }
  if (a[x][y] == '>') {
    if (y == m) {
      return P[x][y] = make_pair(x, y);
    } else {
      if (a[x][y + 1] == '<') {
        return P[x][y] = make_pair(-1, -1);
      } else {
        return P[x][y] = Update(x, y + 1);
      }
    }
  }
  if (a[x][y] == '<') {
    if (y == 1) {
      return P[x][y] = make_pair(x, y);
    } else {
      if (a[x][y - 1] == '>') {
        return P[x][y] = make_pair(-1, -1);
      } else {
        return P[x][y] = Update(x, y - 1);
      }
    }
  }
}
int main() {
  Fastio();
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      Update(i, j);
    }
  }
  while (q--) {
    char type;
    cin >> type;
    if (type == 'C') {
      int x, y;
      cin >> x >> y >> type;
      a[x][y] = type;
      int temp = (x - 1) / bl;
      for (int i = temp * bl + 1; i <= min(temp * bl + bl, n); i++) {
        for (int j = 1; j <= m; j++) {
          P[i][j] = make_pair(0, 0);
        }
      }
      for (int i = temp * bl + 1; i <= min(temp * bl + bl, n); i++) {
        for (int j = 1; j <= m; j++) {
          Update(i, j);
        }
      }
    } else {
      int x, y;
      cin >> x >> y;
      while (x > 0 and y > 0 and x <= n and y <= m) {
        if (P[x][y].first == -1) {
          cout << "-1 -1\n";
          break;
        }
        if (P[x][y] == make_pair(x, y)) {
          if (a[x][y] == '^' and x == 1) {
            cout << 0 << ' ' << y << '\n';
            break;
          }
          if (a[x][y] == '<') {
            cout << x << ' ' << y - 1 << '\n';
            break;
          }
          if (a[x][y] == '>') {
            cout << x << ' ' << y + 1 << '\n';
            break;
          }
          x--;
          continue;
        }
        int tempx = P[x][y].first, tempy = P[x][y].second;
        y = tempy;
        x = tempx;
      }
    }
  }
}
