#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 5;
int pri[maxn];
int tot;
int vis[maxn];
int n;
void init(int x) {
  for (int i = 2; i <= x; i++) {
    if (!vis[i]) pri[tot++] = i;
    for (int j = 0; j < tot && i * pri[j] <= x; j++) {
      vis[i * pri[j]] = 1;
      if (i % pri[j] == 0) break;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  init(n);
  int res = 1, x, sx, p = 0, blk = 69;
  for (int up = sqrt(n); p < tot && pri[p] <= up; p++) {
    int tres = 1;
    if (res * 1ll * pri[p] > 1ll * n) break;
    cout << "B"
         << " " << pri[p] << "\n";
    fflush(stdout);
    cin >> x;
    if (x >= 1) {
      for (int j = pri[p]; j <= n; j *= pri[p]) {
        cout << "A"
             << " " << j << "\n";
        fflush(stdout);
        cin >> sx;
        if (sx >= 1)
          tres = max(tres, j);
        else
          break;
        if (1ll * j * pri[p] > 1ll * n) break;
      }
    }
    res *= tres;
  }
  int pre;
  cout << "A"
       << " " << 1 << "\n";
  fflush(stdout);
  cin >> pre;
  for (int ls = p, rs; ls < tot; ls = rs + 1) {
    rs = min(tot - 1, ls + blk - 1);
    int sum = 0;
    for (int i = ls; i <= rs; i++) {
      cout << "B"
           << " " << pri[i] << "\n";
      fflush(stdout);
      cin >> sx;
      sum += sx;
    }
    cout << "A"
         << " " << 1 << "\n";
    fflush(stdout);
    cin >> sx;
    if ((sx + sum) != pre) {
      for (int i = ls; i <= rs; i++) {
        cout << "A"
             << " " << pri[i] << "\n";
        fflush(stdout);
        cin >> sx;
        if (sx >= 1) {
          res *= pri[i];
          break;
        }
      }
      break;
    } else
      pre = sx;
  }
  cout << "C"
       << " " << res << "\n";
  fflush(stdout);
  return 0;
}
