#include <bits/stdc++.h>
using namespace std;
const int sz = 1e5 + 1;
int n;
int s[sz];
vector<int> prime;
void sieve() {
  for (int i = 2; i <= n; i++) {
    if (s[i] == 0) {
      prime.push_back(i);
      for (int j = i; j <= n; j += i) s[j] = i;
    }
  }
}
int ask(int type, int x) {
  if (type == 0)
    cout << "A " << x << endl;
  else if (type == 1)
    cout << "B " << x << endl;
  else {
    cout << "C " << x << endl;
    return 0;
  }
  int res;
  cin >> res;
  return res;
}
void solve() {
  cin >> n;
  sieve();
  fill(s, s + sz, 0);
  bool gff = 0;
  int l = 0, r = 0;
  vector<int> fact;
  int c = 0;
  int cur_st = n;
  for (int x : prime) {
    int res = ask(1, x);
    int cnt1 = 0, cnt2 = 0;
    for (int i = x; i <= n; i += x) {
      if (s[i] != 0 && s[i] < x) cnt1++;
      if (s[i] == 0) cur_st--;
      cnt2++;
      s[i] = x;
    }
    if (res > cnt2 - cnt1) {
      fact.push_back(x);
      if (!gff) {
        gff = 1;
        r = c - 1;
      }
    }
    if (!gff && (c - l >= 200 || c == 0)) {
      res = ask(0, 1);
      if (cur_st < res) {
        r = c;
        gff = 1;
      } else {
        l = c;
      }
    }
    c++;
  }
  if (!gff) {
    r = c - 1;
    gff = 1;
  }
  int res = ask(0, 1);
  if (res == 1) {
    ask(2, 1);
    return;
  }
  for (int i = l; i <= r; i++) {
    int res = ask(0, prime[i]);
    if (res == 1) {
      fact.push_back(prime[i]);
      break;
    }
  }
  int ans = 1;
  for (int x : fact) {
    long long cur = (long long)x * x;
    while (cur <= n && ask(0, cur) == 1) cur *= x;
    cur /= x;
    ans *= cur;
  }
  ask(2, ans);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q = 1;
  for (; q > 0; q--) {
    solve();
  }
}
