#include <bits/stdc++.h>
using namespace std;
const long long N = 1000009, OO = 1000000000;
long long n, p[N], power[20], used[N], checked[N];
void Solve() {
  scanf("%lld", &n);
  long long i, j, cnt, ans = 1, x, ok = 0, k;
  vector<long long> prime;
  for (i = 2; i <= n; ++i) p[i] = 1;
  for (i = 2; i <= n; ++i)
    if (p[i])
      for (j = i * i; j <= n; j += i) p[j] = 0;
  prime.push_back(0);
  for (i = 1; i <= n; ++i) {
    if (p[i]) prime.push_back(i);
  }
  long long K = sqrt(prime.size() - 1), num = 0, sum = n;
  memset(used, 0, sizeof(used));
  for (i = 1; i < prime.size(); ++i) {
    if (i > K && ans * prime[i] > n) break;
    num = 0;
    for (j = prime[i]; j <= n; j += prime[i])
      if (!used[j]) {
        used[j] = 1, ++num, --sum;
      }
    printf("B %lld\n", prime[i]);
    fflush(stdout);
    scanf("%lld", &cnt);
    if (cnt != num) {
      x = 1;
      for (k = 1; k <= 17; ++k) {
        x *= prime[i];
        if (x > n) break;
        printf("A %lld\n", x);
        fflush(stdout);
        scanf("%lld", &cnt);
        if (cnt)
          ans *= prime[i];
        else
          break;
      }
    }
    if ((i % K == 0 || i == prime.size() - 1) && !ok) {
      printf("A 1\n");
      fflush(stdout);
      scanf("%lld", &cnt);
      if (cnt != sum) {
        for (j = i - K + 1; j <= i; ++j) {
          x = 1;
          for (k = 1; k <= 17; ++k) {
            x *= prime[j];
            if (x > n) break;
            printf("A %lld\n", x);
            fflush(stdout);
            scanf("%lld", &cnt);
            if (cnt)
              ans *= prime[j], ok = 1;
            else
              break;
          }
          if (ok) break;
        }
      }
    }
  }
  printf("C %lld\n", ans);
  fflush(stdout);
}
int main() {
  Solve();
  return 0;
}
