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

 public:
  TaskE(int n) {
    this->n = ++n;
    isPrime.assign(n, true);
    isPrime[0] = isPrime[1] = false;
    for (int i = 2; i < n; i++) {
      if (isPrime[i]) {
        if (1ll * i * i < n) {
          smallPrimes.emplace_back(i);
          for (int j = i * i; j < n; j += i) {
            isPrime[j] = false;
          }
        } else {
          bigPrimes.emplace_back(i);
        }
      }
    }
  }
  void solve() {
    int res = 1;
    for (int prime : smallPrimes) {
      int powerPrime = prime;
      Ask(prime, true);
      while (Ask(powerPrime, false) > 0) {
        res *= prime;
        if (1ll * powerPrime * prime >= n) break;
        powerPrime *= prime;
      }
    }
    if (res != 1) {
      for (int prime : bigPrimes) {
        if (1ll * res * prime < n and Ask(res * prime, true) > 0) {
          res *= prime;
          break;
        }
      }
    } else {
      int rem = Ask(1, false);
      while (!bigPrimes.empty()) {
        int sz = bigPrimes.size();
        int hf = sz / 2;
        for (int cnd = hf; cnd < sz; cnd++) Ask(bigPrimes[cnd], true);
        int nrem = Ask(1, false);
        if (rem - nrem != sz - hf) {
          for (int cnd = hf; cnd < sz; cnd++) {
            if (Ask(bigPrimes[cnd], false) > 0) {
              res *= bigPrimes[cnd];
              break;
            }
          }
          break;
        }
        rem = nrem;
        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();
}
