#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
bool npr[N];
vector<int> pr, fac;
void sieve() {
  for (int i = 2; i < N; i++) {
    if (!npr[i]) {
      pr.push_back(i);
      for (int j = i + i; j < N; j += i) npr[j] = 1;
    }
  }
}
int query(int x = 1, int t = 1) {
  char c = (t ? 'A' : 'B');
  cout << c << ' ' << x << '\n' << flush;
  cin >> x;
  return x;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  sieve();
  int p = 0, cnt = n;
  vector<int> tmp;
  while (pr[p] <= n) {
    cnt -= query(pr[p], 0);
    tmp.push_back(pr[p]);
    if (p and p % 97 == 0 or pr[p + 1] > n) {
      int cur = query();
      if (cur != cnt)
        for (auto i : tmp) {
          if (query(i)) fac.push_back(i), cnt++;
          if (cnt == cur) break;
        }
      tmp.resize(0);
      if (pr[p + 1] > n) break;
    }
    p++;
  }
  int ans = 1;
  for (auto i : fac) {
    long long cur = 1ll * i * i, ma = i;
    while (cur <= n) {
      if (query(cur)) ma = cur;
      cur *= i;
    }
    ans *= ma;
  }
  cout << 'C' << ' ' << ans << '\n' << flush;
}
