#include <bits/stdc++.h>
using namespace std;
vector<int> pr;
void func() {
  vector<int> ipr(100005, 1);
  for (int i = 2; i < 100005; i++) {
    if (ipr[i]) {
      pr.push_back(i);
      for (int j = 2 * i; j < 100005; j += i) ipr[j] = 0;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  func();
  int n;
  cin >> n;
  if (n == 1) {
    cout << "C 1" << endl;
    return 0;
  }
  int st = 0;
  vector<int> cr;
  int an = 1;
  for (int i = 0; pr[i] <= sqrt(n); i++) {
    int x1, x2;
    cout << "B " << pr[i] << endl;
    cin >> x1;
    cout << "B " << pr[i] << endl;
    cin >> x2;
    if (x2) cr.push_back(pr[i]), an *= pr[i];
    st = i + 1;
  }
  if (cr.size()) {
    for (int i = 0; i < cr.size(); i++) {
      while (an * cr[i] <= n) {
        cout << "A " << an * cr[i] << endl;
        int x;
        cin >> x;
        if (x)
          an *= cr[i];
        else
          break;
      }
    }
  }
  cout << "A 1" << endl;
  int rem;
  cin >> rem;
  while (1) {
    int cnt = 0;
    int x;
    while (cnt++ < 100 and pr[st] <= n) {
      cout << "B " << pr[st] << endl;
      cin >> x;
      if (x == 2) {
        cout << "C " << pr[st] * an << endl;
        return 0;
      }
      st++;
    }
    cnt--;
    rem -= cnt;
    cout << "A 1" << endl;
    cin >> x;
    if (x > rem) {
      for (int i = st - cnt; i < st; i++) {
        cout << "A " << pr[i] << endl;
        cin >> x;
        if (x) {
          cout << "C " << pr[i] << endl;
          return 0;
        }
      }
    }
    if (pr[st] > n) break;
  }
  cout << "C " << an << endl;
  return 0;
}
