#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int prime[N], cnt;
bool vis[N];
void phi(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]] = 1;
      if (i % prime[j] == 0) break;
    }
  }
}
long long query(char c, long long x) {
  printf("%c %lld\n", c, x);
  fflush(stdout);
  scanf("%lld", &x);
  return x;
}
int main() {
  long long n;
  scanf("%lld", &n);
  phi(n);
  int block = sqrt(cnt);
  int ans = 1;
  long long sum = n;
  for (int i = 1; i <= cnt; i += block) {
    int lim = min(cnt, i + block - 1);
    for (int j = i; j <= lim; j++) {
      long long x = query('B', prime[j]);
      sum -= x;
    }
    long long y = query('A', 1);
    if (y > sum) {
      sum = y;
      for (int j = i; j <= lim; j++) {
        for (long long k = prime[j]; k <= n; k *= prime[j]) {
          long long x = query('B', k);
          if (x)
            ans *= prime[j];
          else
            break;
        }
      }
    }
  }
  printf("C %d\n", ans);
  return 0;
}
