#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int ans = 1;
int cnt, vis[maxn], pri[maxn];
void getPrime(int n) {
  for (int i = 2; i <= n; ++i) {
    if (!vis[i]) pri[++cnt] = i;
    for (int j = 1; i * pri[j] <= n && j <= cnt; ++j) {
      vis[i * pri[j]] = 1;
      if (i % pri[j] == 0) break;
    }
  }
}
int n;
int main() {
  scanf("%d", &n);
  getPrime(n);
  int num = n, m = 0, st = 0;
  for (int i = 1; i <= cnt; ++i)
    if (pri[i] * pri[i] <= n)
      ++m, st = i;
    else
      break;
  m = cnt - m;
  int b = sqrt(m);
  for (int l = st + 1, r = 0, x; l <= cnt; l = r + 1) {
    r = min(l + b - 1, cnt);
    for (int i = l; i <= r; ++i) {
      printf("B %d\n", pri[i]);
      fflush(stdout);
      scanf("%d", &x);
      num -= x;
    }
    printf("A 1\n");
    fflush(stdout);
    scanf("%d", &x);
    if (num != x) {
      for (int i = l; i <= r; ++i) {
        printf("A %d\n", pri[i]);
        fflush(stdout);
        scanf("%d", &x);
        if (x) {
          ans = pri[i];
          break;
        }
      }
      break;
    }
  }
  for (int i = 1, x, y, pro; i <= st; ++i) {
    x = pri[i];
    pro = 1;
    printf("B %d\n", x);
    fflush(stdout);
    scanf("%d", &y);
    while (1) {
      pro *= x;
      if (pro > n) break;
      printf("A %d\n", pro);
      fflush(stdout);
      scanf("%d", &y);
      if (!y) break;
      ans *= x;
    }
  }
  printf("C %d\n", ans);
  return 0;
}
