#include <bits/stdc++.h>
int main(void) {
  int n;
  std::cin >> n;
  const int mod = 100;
  bool isPrime[101010];
  std::fill_n(isPrime, 101010, true);
  isPrime[0] = isPrime[1] = false;
  int ans = 1;
  int cnt = 0;
  int prev = 2;
  int cntprimes = 0;
  for (int i = 2; i <= n; i++) {
    if (!isPrime[i]) continue;
    cntprimes++;
    for (int j = i + i; j <= n; j += i) {
      if (isPrime[j]) {
        isPrime[j] = false;
      }
    }
    std::cout << "B " << i << std::endl;
    int resp;
    std::cin >> resp;
    cnt += resp;
    if (cntprimes % mod == 0) {
      std::cout << "A " << 1 << std::endl;
      int resp;
      std::cin >> resp;
      if (resp != n - cnt) {
        for (int j = prev; j < i; j++) {
          if (!isPrime[j]) continue;
          long long k = j;
          while (k <= n) {
            std::cout << "B " << k << std::endl;
            int resp;
            std::cin >> resp;
            if (resp == 0) break;
            ans *= j;
            k *= j;
          }
        }
        cnt = n - resp;
      }
      prev = i;
    }
  }
  for (int j = prev; j <= n; j++) {
    if (!isPrime[j]) continue;
    long long k = j;
    while (k <= n) {
      std::cout << "B " << k << std::endl;
      int resp;
      std::cin >> resp;
      if (resp == 0) break;
      ans *= j;
      k *= j;
    }
  }
  std::cout << "C " << ans << std::endl;
  return 0;
}
