#include <bits/stdc++.h>
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const long long llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end() {}
int n, totquery, del[N];
int tot, pri[N], vis[N];
void shaipri(int lim) {
  for (int i = 2; i <= lim; ++i) {
    if (!vis[i]) vis[i] = i, pri[++tot] = i;
    for (int j = 1; j <= lim && i * pri[j] <= lim; ++j) {
      vis[i * pri[j]] = pri[j];
      if (i % pri[j] == 0) break;
    }
  }
}
inline void solve() {
  scanf("%d", &n);
  shaipri(n);
  int i;
  for (i = 1; pri[i] * pri[i] <= n && i <= tot; ++i)
    ;
  int ans = 1, cnt = 0, bl = 200, totdel = 0, lsti = i;
  for (int j = i; j <= tot; ++j) {
    int p = pri[j];
    cnt++;
    printf("B %d\n", p), fflush(stdout), ++totquery;
    int x;
    scanf("%d", &x);
    for (int k = p; k <= n; k += p)
      if (!del[k]) totdel++, del[k] = 1;
    if (cnt == bl || j == tot) {
      printf("A 1\n"), fflush(stdout), ++totquery;
      scanf("%d", &x);
      if (x != n - totdel) {
        for (int k = lsti; k <= j; ++k) {
          printf("A %d\n", pri[k]), fflush(stdout), ++totquery;
          scanf("%d", &x);
          if (x) {
            ans *= pri[k];
            break;
          }
        }
        break;
      }
      cnt = 0;
      lsti = j;
    }
  }
  for (int j = 1; j < i; ++j) {
    int p = pri[j], x;
    printf("B %d\n", p), fflush(stdout), ++totquery;
    scanf("%d", &x);
    bool flag = false;
    while (p <= n / ans) {
      printf("A %d\n", p), fflush(stdout), ++totquery;
      scanf("%d", &x);
      if (x == 0) {
        flag = true;
        ans *= p / pri[j];
        break;
      }
      p *= pri[j];
    }
    if (!flag) ans *= p / pri[j];
  }
  printf("C %d\n", ans), ++totquery;
  assert(totquery <= 10000);
}
int main() {
  TIME__START = clock();
  int Test = 1;
  while (Test--) {
    solve();
  }
  TIME__END = clock();
  program_end();
  return 0;
}
