#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int vis[N], used[N];
vector<int> prime;
void getprime(int n) {
  for (int i = 2; i <= n; ++i) {
    if (!vis[i]) {
      prime.push_back(i);
    }
    for (int p : prime) {
      int v = p * i;
      if (v > n) break;
      vis[v] = 1;
      if (i % p == 0) break;
    }
  }
}
int ask(int x) {
  cout << "A " << x << endl;
  int p;
  cin >> p;
  return p;
}
int del(int x) {
  cout << "B " << x << endl;
  int p;
  cin >> p;
  return p;
}
int main() {
  int n;
  cin >> n;
  getprime(n);
  int cnt = prime.size();
  int blk = sqrt(cnt);
  int ans = 1;
  int res = n;
  int siz = cnt - 1;
  int rcd = n + 1;
  for (int i = 0; i <= siz; ++i) {
    int nxt = i + blk - 1;
    nxt = min(nxt, siz);
    for (int j = i; j <= nxt; ++j) {
      int x = prime[j];
      del(x);
      for (int k = x; k <= n; k += x)
        if (!used[k]) used[k] = 1, res--;
    }
    int tp = ask(1);
    if (tp != res) {
      rcd = i;
      break;
    }
    i = nxt;
  }
  for (int i = rcd; i <= siz; ++i) {
    int x = prime[i];
    int res = 0;
    if (ans * x > n) break;
    for (long long j = x; j <= n; j *= x) {
      if (!used[j]) res++;
    }
    for (long long j = x; j <= n; j *= x) {
      int tp = ask(j);
      if (tp != res)
        ans *= x;
      else
        break;
      if (!used[j]) res--;
    }
  }
  cout << "C " << ans << endl;
}
