#include <bits/stdc++.h>
using namespace std;
int dfs(int k, vector<int> &v, int n, int s, long long p, int t) {
  int r = 0;
  if (s % 2) {
    r = n / p;
  } else {
    r = -n / p;
  }
  for (int i = t; i < k && p * v[i] <= n; ++i) {
    r += dfs(k, v, n, s + 1, p * v[i], i + 1);
  }
  return r;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<bool> vj(n + 1, true);
  vector<bool> a(n + 1, true);
  for (int i = 2; i <= n; ++i)
    if (a[i]) {
      for (int j = 2; i * j <= n; ++j) a[i * j] = false;
    }
  vector<int> v;
  for (int i = 2; i <= n; ++i)
    if (a[i]) {
      v.push_back(i);
    }
  int m = v.size();
  vector<bool> isp(n + 1, false);
  int first = true;
  long long ans = 1;
  int t = 0;
  int sum = 0;
  for (int i = 0; i < m; ++i) {
    cout << "B " << v[i] << endl;
    int k;
    cin >> k;
    int cur = dfs(i, v, n, 1, v[i] * 1ll, 0);
    sum += cur;
    if (k != cur) {
      isp[v[i]] = true;
      ans *= v[i];
    }
    ++t;
    if ((t * t >= m || i == m - 1) && first) {
      cout << "A 1" << endl;
      cin >> k;
      if (n - k != sum) {
        for (int j = i - t + 1; j <= i; ++j) {
          cout << "A " << v[j] << endl;
          cin >> k;
          if (k) {
            isp[v[j]] = true;
            ans *= v[j];
            break;
          }
        }
        first = false;
      }
      t = 0;
    }
  }
  if (first) {
    cout << "C 1" << endl;
    return 0;
  }
  for (int i = 2; i <= n; ++i)
    if (isp[i]) {
      while (ans * i <= n) {
        cout << "A " << ans * i << endl;
        int k;
        cin >> k;
        if (k)
          ans *= i;
        else
          break;
      }
    }
  cout << "C " << ans << endl;
  return 0;
}
