#include <bits/stdc++.h>
using namespace std;
const int MX = 1e5 + 5;
bitset<MX> val;
long long n, res;
set<long long> primes;
vector<pair<int, int> > pr;
void pre() {
  val.set();
  for (int i = 2; i <= n; ++i) {
    if (val[i]) {
      int cnt = 0;
      for (int j = i; j <= n; j += i) {
        if (val[j]) ++cnt;
        val[j] = 0;
      }
      pr.push_back({i, cnt});
    }
  }
}
bool ok(long long x) {
  cout << "A " << x << endl;
  cin >> res;
  return (res == 1);
}
long long bsearch(long long fac, long long l, long long r) {
  long long lf = 1, rf = 1;
  for (int i = 0; i < (l); ++i) lf *= fac;
  for (int i = 0; i < (r); ++i) rf *= fac;
  if (l == r) return r;
  if (l == r - 1) {
    if (ok(rf)) return r;
    return l;
  } else {
    long long m = (l + r) / 2;
    long long mf = 1;
    for (int i = 0; i < (m); ++i) mf *= fac;
    if (ok(mf))
      return bsearch(fac, m, r);
    else
      return bsearch(fac, l, m - 1);
  }
}
int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  pre();
  if (n == 1) {
    cout << "C 1" << endl;
    return 0;
  }
  long long removed = 0, index = 0;
  bool firstFound = false;
  for (int i = 0; i < ((int)(pr).size()); ++i) {
    cout << "B " << pr[i].first << endl;
    cin >> res;
    removed += res;
    if (res > pr[i].second) {
      primes.insert(pr[i].first);
    }
    ++index;
    if (index == 250 || i + 1 == (int)(pr).size()) {
      cout << "A 1" << endl;
      cin >> res;
      if (res != n - removed && !firstFound) {
        firstFound = true;
        int st = i - index + 1;
        for (int j = st; j < (i + 1); ++j) {
          cout << "A " << pr[j].first << endl;
          cin >> res;
          if (res) {
            primes.insert(pr[j].first);
            break;
          }
        }
      }
      index = 0;
    }
  }
  long long ans = 1;
  for (auto i : primes) {
    long long mx = 1, product = i;
    while (product <= n) {
      ++mx;
      product *= i;
    }
    long long times = bsearch(i, 1, mx - 1);
    for (int j = 0; j < (times); ++j) ans *= i;
  }
  cout << "C " << ans << endl;
}
