#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
constexpr int SIZE = 1e5 + 1;
constexpr int PRSIZE = 1e4;
int primelist[PRSIZE], pcnt = 0;
bool isprime[SIZE];
int n;
void init() {
  for (int i = 2; i <= n; ++i) isprime[i] = true;
  for (int i = 2; i <= n; ++i) {
    if (isprime[i] == true) {
      primelist[pcnt++] = i;
      for (int j = 2; j * i <= n; ++j) isprime[i * j] = false;
    }
  }
}
inline int fpow(int a, int b) {
  if (b == 0) return 1;
  if (a == 0) return 0;
  int ans = 1, base = a;
  for (; b > 0; b /= 2) {
    if (b & 1) ans *= base;
    base = base * base;
  }
  return ans;
}
constexpr int BLOCKSIZE = 98;
int block[BLOCKSIZE], bcnt;
int main() {
  n = read();
  int sq = sqrt(double(n));
  init();
  int ans = 1;
  int LLCNT = n;
  for (int i = 0; i < pcnt; ++i) {
    int now = primelist[i];
    int answerA, answerB;
    if (primelist[i] <= sq) {
      cout << "B " << now << endl;
      cin >> answerB;
      LLCNT -= answerB;
      cout << "A " << now << endl;
      cin >> answerA;
      int factor = 1;
      if (answerA != 0) {
        LLCNT += answerA;
        int base = now;
        factor = base;
        for (int j = 2; base * now <= n; ++j) {
          base *= now;
          cout << "A " << base << endl;
          cin >> answerA;
          if (answerA == 1)
            factor = base;
          else
            break;
        }
        ans *= factor;
      }
    } else if (ans <= sqrt(n)) {
      cout << "B " << now << endl;
      block[bcnt++] = now;
      cin >> answerB;
      LLCNT -= answerB;
      if (bcnt == BLOCKSIZE || i == pcnt - 1) {
        cout << "A " << 1 << endl;
        int realcnt;
        cin >> realcnt;
        if (realcnt > LLCNT) {
          for (int ib = 0; ib < bcnt; ++ib) {
            cout << "A " << block[ib] << endl;
            cin >> answerA;
            if (answerA == 1) {
              ans *= block[ib];
              bcnt = 0;
              break;
            }
          }
        }
        bcnt = 0;
      }
    } else
      break;
  }
  cout << "C " << ans << endl;
  return 0;
}
