#include <bits/stdc++.h>
using namespace std;
const long long N = 100100;
vector<long long> primes;
bool mark[N];
long long n;
void crivo() {
  for (long long i = 2; i <= n; i++) {
    if (!mark[i]) {
      if (i <= n) primes.push_back(i);
      for (long long j = 2 * i; j <= n; j += i) mark[j] = 1;
    }
  }
}
bool saiu[N];
long long askB(long long p) {
  if (p > n) return 0;
  cout << 'B' << " " << p << '\n';
  cout.flush();
  long long ans;
  cin >> ans;
  return ans;
}
long long askA(long long p) {
  if (p > n) return 0;
  cout << "A " << p << '\n';
  cout.flush();
  long long ans;
  cin >> ans;
  return ans;
}
long long get(long long p) {
  long long res = 0;
  for (long long i = p; i <= n; i += p) {
    if (saiu[i]) continue;
    res++;
    saiu[i] = 1;
  }
  return res;
}
long long getlog(long long x, long long mx) {
  long long r = 1;
  long long p = x;
  while (p * x <= mx) {
    p *= x;
    r++;
  }
  return r;
}
long long elevate(long long p, long long pwr) {
  long long r = 1;
  for (long long i = 0; i < pwr; i++) r *= p;
  return r;
}
const long long sq = 100;
long long P = 1;
void solve(vector<long long> cur) {
  for (long long p : cur) {
    long long x = askB(p);
    if (x != 0) {
      long long l = 2, r = getlog(p, n / P);
      long long res = 1;
      while (l <= r) {
        long long mid = (l + r) / 2;
        long long per = askA(P * elevate(p, mid));
        if (per != 0) {
          res = mid, l = mid + 1;
        } else
          r = mid - 1;
      }
      P *= elevate(p, res);
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  crivo();
  vector<long long> cur;
  long long fora = 0;
  long long i = 0;
  for (i = 0; i <= (long long)(primes).size(); i++) {
    if (i == (long long)(primes).size()) {
      solve(cur);
      break;
    }
    cur.push_back(primes[i]);
    long long x = askB(primes[i]);
    long long s = get(primes[i]);
    fora += x;
    if (s != x) {
      solve(cur);
      break;
    }
    if ((long long)(cur).size() == sq) {
      long long A = askA(1);
      if (A != n - fora) {
        solve(cur);
        break;
      }
      cur.clear();
    }
  }
  if (P == 1) {
    cout << "C " << 1 << '\n';
    cout.flush();
    return 0;
  }
  i++;
  for (; i < (long long)(primes).size(); i++) {
    long long p = primes[i];
    if (p <= 1 || p > n) continue;
    long long per = askA(primes[i] * P);
    if (per != 0) {
      long long l = 2, r = getlog(p, n / P);
      long long res = 1;
      while (l <= r) {
        long long mid = (l + r) / 2;
        per = askA(elevate(p, mid) * P);
        if (per != 0) {
          l = mid + 1;
          res = mid;
        } else
          r = mid - 1;
      }
      P *= elevate(p, res);
    }
  }
  cout << "C " << P << '\n';
  cout.flush();
  return 0;
}
