#include <bits/stdc++.h>
using namespace std;
int find_multiples(int a) {
  cout << "A " << a << endl;
  int res;
  cin >> res;
  return res;
}
int find_and_delete_multiples(int a) {
  cout << "B " << a << endl;
  int res;
  cin >> res;
  return res;
}
void answer(int a) { cout << "C " << a << endl; }
bool sieve[100003];
vector<int> prime;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    if (sieve[i]) continue;
    prime.push_back(i);
    for (int j = 2; i * j <= n; j++) {
      sieve[i * j] = true;
    }
  }
  int cnt = n;
  vector<int> pv;
  for (int i = 0; i < (int)prime.size(); i += 100) {
    for (int j = i; j < min(i + 100, (int)prime.size()); j++) {
      cnt -= find_and_delete_multiples(prime[j]);
    }
    int cur = find_multiples(1);
    if (cnt != cur) {
      cnt = cur;
      for (int j = i; j < min(i + 100, (int)prime.size()); j++) {
        if (find_multiples(prime[j])) pv.push_back(prime[j]);
      }
    }
  }
  int ans = 1;
  for (auto &p : pv) {
    ans *= p;
  }
  for (auto &p : pv) {
    int cur = p;
    while (1LL * ans * p <= 1LL * n && find_multiples(cur * p)) {
      ans *= p;
      cur *= p;
    }
  }
  answer(ans);
  return 0;
}
