#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
vector<int> primes;
int lpf[N + 1];
void sieve(int n) {
  for (int i = 2; i <= n; i++) {
    if (lpf[i] == 0) {
      lpf[i] = i;
      primes.push_back(i);
    }
    for (int j = 0; j < (int)primes.size() && primes[j] <= lpf[i] &&
                    1LL * i * primes[j] <= n;
         ++j)
      lpf[i * primes[j]] = primes[j];
  }
}
signed main() {
  4;
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  auto query = [&](char c, int q) {
    cout << c << " " << q << endl;
    int ret;
    cin >> ret;
    return ret;
  };
  int n;
  cin >> n;
  if (n == 1) {
    cout << "C 1" << endl;
    return 0;
  }
  sieve(n);
  int sq = sqrt(n) + 1;
  int answer = 1;
  vector<int> big;
  for (int p : primes) {
    if (1ll * p * p <= n) {
      query('B', p);
      int pp = p;
      while (pp <= n and query('A', pp) > 0) {
        answer *= p;
        pp *= p;
      }
    } else {
      big.push_back(p);
    }
  }
  int l = 0;
  int r = big.size();
  int cur_count = query('A', 1);
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    int p = 0;
    for (int i = l; i < mid; i++) {
      p += query('B', big[i]);
    }
    int new_count = query('A', 1);
    if (cur_count - p < new_count) {
      r = mid;
      cur_count = new_count;
    } else {
      l = mid;
      cur_count = new_count;
    }
  }
  int p = query('B', big[l]);
  int new_count = query('A', 1);
  if (cur_count - p < new_count) {
    answer *= big[l];
  }
  cout << "C " << answer << endl;
}
