#include <testlib.h>

const int maxr = 500;
const int maxn = 1000;

int main() {
  registerValidation();
  int w = inf.readInt(1, maxr, "w");
  inf.readSpace();
  int h = inf.readInt(1, maxr, "h");
  inf.readSpace();
  inf.readInt(1, maxn, "n");
  inf.readEoln();
  int cnt_t = 0, cnt_v = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      char c = inf.readChar();
      switch (c) {
        case 'A':
          break;
        case 'T':
          cnt_t++;
          break;
        case 'V':
          cnt_v++;
          break;
        default:
          ensuref(c == 'A' || c == 'T' || c == 'V', "bad map character: '%c'", c);
      }
    }
    inf.readEoln();
  }
  inf.readEof();
  ensuref(cnt_t >= 1, "not enough bureaucrats (need at least one)");
  ensuref(cnt_v == 1, "But where is V?");
  return 0;
}

