#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
const int N = 1e5 + 1;
bool isPrime[N];
vector<int> primes;
int mnDiv[N];
void sieve() {
  for (int i = 2; i < N; i++) isPrime[i] = true, mnDiv[i] = -1;
  for (int i = 2; i < N; i++) {
    if (isPrime[i]) {
      primes.push_back(i);
      mnDiv[i] = i;
      for (int j = i + i; j < N; j += i) {
        if (mnDiv[j] == -1) mnDiv[j] = i;
        isPrime[j] = false;
      }
    }
  }
}
const int SQ = 100;
int ddd;
int ask(char c, int x) {
  if (ddd > 9990) {
    while (true)
      ;
    exit(0);
  }
  cout << c << " " << x << endl;
  fflush(stdout);
  ddd++;
  if (c == 'C') exit(0);
  int y;
  cin >> y;
  return y;
}
int n;
int cnt[N];
int main() {
  ios_base::sync_with_stdio(false);
  sieve();
  cin >> n;
  cnt[1] = n;
  for (int i = 2; i <= n; i++) cnt[mnDiv[i]]++;
  int d = 0;
  vector<int> factors;
  bool first = false;
  for (int i = 0; i < primes.size(); i++) {
    d++;
    if (d % SQ == 0 && !first) {
      int ans = ask('A', 1);
      if (ans != cnt[1]) {
        first = true;
        for (int j = d - SQ; j < d; j++) {
          int y = primes[j];
          int ans = ask('A', y);
          if (ans != 0) {
            factors.push_back(y);
            break;
          }
        }
      }
    }
    int x = primes[i];
    if (x > n) break;
    int ans = ask('B', x);
    cnt[1] -= cnt[x];
    if (ans != cnt[x]) factors.push_back(x);
    cnt[x] = 0;
  }
  if (!first) {
    int ans = ask('A', 1);
    if (ans != cnt[1]) {
      first = true;
      for (int j = max(0, d - SQ); j < primes.size(); j++) {
        int y = primes[j];
        if (y > n) break;
        int ans = ask('A', y);
        if (ans != 0) {
          factors.push_back(y);
          break;
        }
      }
    }
  }
  for (auto &x : factors) {
    ll cur = 1LL * x * x;
    while (cur <= n) {
      ll ans = ask('A', cur);
      if (ans == 0) break;
      cur *= x;
    }
    cur /= x;
    x = cur;
  }
  ll res = 1;
  for (auto x : factors) res *= x;
  ask('C', res);
  return 0;
}
