#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
bool prime[N];
int n;
vector<int> a;
int main() {
  int n;
  cin >> n;
  int res = 1;
  for (int i = 2; i <= n; i++)
    if (!prime[i]) {
      for (int j = 2; i * j <= n; j++) prime[i * j] = true;
      if (1LL * i * i <= n) {
        int j = 1;
        int tmp = 1;
        while (i * tmp <= n) {
          int cnt;
          cout << "B " << i * tmp << endl;
          cin >> cnt;
          cout << "A " << i * tmp << endl;
          cin >> cnt;
          if (cnt == 0) break;
          j++;
          tmp *= i;
        }
        res *= tmp;
      } else
        a.push_back(i);
    }
  if (res == 1) {
    int pos = 0;
    int m = a.size();
    while (m > 0 && a[pos] * res <= n) {
      int len = (m + 1) / 2;
      for (int i = 0; i < len; i++) {
        int tmp;
        cout << "B " << a[pos + i] << endl;
        cin >> tmp;
      }
      int cnt = 0;
      cout << "A " << 1 << endl;
      cin >> cnt;
      if (cnt - 1 != m - len) {
        bool flag = false;
        for (int i = 0; i < len; i++) {
          int cnt;
          cout << "A " << a[pos + i] << endl;
          cin >> cnt;
          if (cnt == 1) {
            res *= a[pos + i];
            flag = true;
            break;
          }
        }
        if (flag) break;
      } else {
        m -= len;
        pos += len;
      }
    }
  } else {
    for (int i = 0; i < (int)a.size(); i++) {
      int cnt;
      cout << "A " << a[i] << endl;
      cin >> cnt;
      if (cnt == 2) res *= a[i];
    }
  }
  cout << "C " << res << endl;
  return 0;
}
