#include <bits/stdc++.h>
using namespace std;
class TaskE {
  int64_t n;
  vector<int64_t> primes;
  vector<bool> isPrime;
  int64_t Ask(int64_t candidate, bool deleteMode) {
    int64_t res;
    if (deleteMode) {
      cout << 'B' << ' ' << candidate << endl;
      cin >> res;
    } else {
      cout << 'A' << ' ' << candidate << endl;
      cin >> res;
    }
    return res;
  }

 public:
  TaskE(int64_t n) {
    this->n = ++n;
    isPrime.assign(n, true);
    isPrime[0] = isPrime[1] = false;
    for (int64_t i = 2; i < n; i++) {
      if (isPrime[i]) {
        for (int64_t j = i * i; j < n; j += i) {
          isPrime[j] = false;
        }
      }
    }
    for (int64_t i = 0; i < n; i++) {
      if (isPrime[i]) primes.emplace_back(i);
    }
  }
  void solve() {
    int64_t res = 1;
    vector<int64_t> bigPrimes;
    for (int64_t prime : primes) {
      int64_t primeWithPower = prime;
      if (prime * prime < n) {
        Ask(primeWithPower, true);
        while (primeWithPower < n and Ask(primeWithPower, false) > 0) {
          res *= prime;
          primeWithPower *= prime;
        }
      } else {
        bigPrimes.emplace_back(prime);
      }
    }
    if (res != 1) {
      for (int64_t prime : bigPrimes) {
        if (res * prime < n and Ask(res * prime, true) > 0) {
          res *= prime;
          break;
        }
      }
    } else {
      int64_t rem = Ask(1, false);
      while (!bigPrimes.empty()) {
        int64_t sz = bigPrimes.size();
        int64_t hf = sz / 2;
        for (int64_t cnd = hf; cnd < sz; cnd++) Ask(bigPrimes[cnd], true);
        int64_t cur = Ask(1, false);
        if (rem - cur != sz - hf) {
          for (int64_t cnd = hf; cnd < sz; cnd++) {
            if (Ask(bigPrimes[cnd], false) > 0) {
              res *= bigPrimes[cnd];
              break;
            }
          }
          break;
        }
        rem = cur;
        bigPrimes.resize(hf);
      }
    }
    cout << 'C' << ' ' << res << endl;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int64_t n;
  cin >> n;
  TaskE E(n);
  E.solve();
}
