#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T a) {
  for (auto x : a) cout << x << ' ';
  cout << '\n';
}
long long ask_n() {
  cout << "A 1" << endl;
  long long ans;
  cin >> ans;
  return ans;
}
long long ask(long long a) {
  cout << "B " << a << endl;
  long long ans;
  cin >> ans;
  return ans;
}
void answer(long long a) { cout << "C " << a << endl; }
void solve() {
  vector<long long> primes;
  long long n;
  cin >> n;
  for (long long i = 2; i <= n; i++) {
    bool prime = true;
    for (long long j = 2; j * j <= i; j++) {
      if (i % j == 0) prime = false;
    }
    if (prime) primes.push_back(i);
  }
  long long sqrt = 98;
  vector<bool> used(n + 1, false);
  long long free = n;
  vector<long long> factors;
  bool done = false;
  for (long long i = 0; i < (long long)primes.size(); i += sqrt) {
    for (long long j = 0; j < sqrt && (i + j) < (long long)primes.size(); j++) {
      long long cnt = ask(primes[i + j]);
      long long supposed = 0;
      for (long long k = primes[i + j]; k <= n; k += primes[i + j])
        if (!used[k]) {
          supposed++;
          free--;
          used[k] = true;
        }
      if (cnt != supposed) factors.push_back(primes[i + j]);
    }
    long long cnt = ask_n();
    if (cnt != free && !done) {
      done = true;
      for (long long j = 0; j < sqrt && (i + j) < (long long)primes.size();
           j++) {
        if (ask(primes[i + j])) {
          factors.push_back(primes[i + j]);
          break;
        }
      }
    }
  }
  long long ans = 1;
  for (long long x : factors) {
    for (long long cur = x; cur <= n; cur *= x) {
      if (ask(cur)) ans *= x;
    }
  }
  answer(ans);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (long long i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
