#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int M = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int mod = 10007;
int prime[N];
bool vis[N];
int cnt, t[N], x;
void init(int n) {
  for (int i = 2; i <= n; i++) {
    if (!vis[i]) prime[++cnt] = i;
    for (int j = 1; j <= cnt && i * prime[j] <= n; j++) {
      vis[i * prime[j]] = true;
      if (i % prime[j] == 0) break;
    }
  }
}
int Find(int l, int r) {
  for (int i = l; i <= r; i++) {
    if ((printf("A %d\n", prime[i]), fflush(stdout), scanf("%d", &x), x))
      return prime[i];
  }
  return 1;
}
int main() {
  int n;
  scanf("%d", &n);
  init(n);
  int i, tot = 0;
  for (i = 1; i <= cnt && prime[i] * prime[i] <= n; i++) {
    (printf("B %d\n", prime[i]), fflush(stdout), scanf("%d", &x));
    if ((printf("A %d\n", prime[i]), fflush(stdout), scanf("%d", &x), x))
      t[++tot] = prime[i];
  }
  int k = i;
  if (tot) {
    int sum = 1;
    for (int i = 1; i <= tot; i++) {
      sum *= t[i];
    }
    for (int i = 1; i <= tot; i++) {
      while (sum * t[i] <= n && (printf("A %d\n", sum * t[i]), fflush(stdout),
                                 scanf("%d", &x), x)) {
        sum *= t[i];
      }
    }
    for (int i = k; i <= cnt; i++) {
      if ((printf("A %d\n", prime[i]), fflush(stdout), scanf("%d", &x), x) ==
          2) {
        printf("C %d\n", sum * prime[i]);
        exit(0);
      }
    }
    printf("C %d\n", sum);
    exit(0);
  }
  int cur, S, ct = 0;
  for (cur = cnt - i + 2, S = sqrt(cur); i <= cnt; ++i)
    if ((printf("B %d\n", prime[i]), fflush(stdout), scanf("%d", &x)), --cur,
        ++ct == S) {
      if ((printf("A %d\n", 1), fflush(stdout), scanf("%d", &x), x) != cur)
        return (printf("C %d\n", Find(i - S + 1, i)), fflush(stdout)), 0;
      ct = 0;
    }
  return (printf("C %d\n",
                 (printf("A %d\n", 1), fflush(stdout), scanf("%d", &x), x) != 1
                     ? Find(cnt - ct + 1, cnt)
                     : 1),
          fflush(stdout)),
         0;
  return 0;
}
