#include <bits/stdc++.h>
using namespace std;
long long n, c1, c2 = -1, c3;
bitset<100001> b;
vector<long long> v;
bool b1;
int main() {
  cin >> n;
  c3 = n;
  for (long long i = 2; i <= n; i++) {
    if (!b[i]) {
      v.push_back(i);
      for (long long t = i * i; t <= n; t += i) b[t] = 1;
    }
  }
  for (int i = 0; i <= v.size() / 100; i++) {
    for (int t = i * 100; t < (i + 1) * 100 && t < v.size(); t++) {
      cout << "B " << v[t] << "\n";
      cout.flush();
      cin >> c1;
      c3 -= c1;
    }
    cout << "A " << 1 << "\n";
    cout.flush();
    cin >> c1;
    if (c1 >= c3 + 1) {
      c2 = i;
      break;
    }
  }
  if (c2 == -1) {
    cout << "C " << 1 << "\n";
    cout.flush();
    cin >> c1;
    return 0;
  }
  for (int t = c2 * 100; t < (c2 + 1) * 100 && t < v.size(); t++) {
    cout << "A " << v[t] << "\n";
    cout.flush();
    cin >> c1;
    if (c1 == 1) {
      c2 = t;
      c3 = v[t];
      break;
    }
  }
  for (int i = c2; i < v.size(); i++) {
    b1 = 1;
    while (b1 && c3 * v[i] <= n) {
      cout << "A " << c3 * v[i] << "\n";
      cout.flush();
      cin >> c1;
      if (c1 == 1)
        c3 *= v[i];
      else
        b1 = 0;
    }
  }
  cout << "C " << c3 << "\n";
  cout.flush();
  cin >> c1;
  return 0;
}
