#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using lli = long long int;
using iii = tuple<int, int, int>;
using ulli = unsigned long long int;
using ui = unsigned int;
const int maxn = 2e5;
const int maxm = 1e7;
const int maxl = 18;
const int inf = 0x3f3f3f3f;
const lli INF = 0x3f3f3f3f3f3f3f3f;
const char sp = ' ';
const char dl = '\n';
const int mod = 1e9 + 7;
int ask(char c, lli x) {
  cout << c << sp << x << endl;
  int ans;
  cin >> ans;
  return ans;
}
int main() {
  lli n;
  cin >> n;
  vector<bool> isprime(n + 1, true);
  vector<int> prime;
  isprime[0] = isprime[1] = false;
  for (int i = 2; i <= n; i++)
    if (isprime[i]) {
      prime.push_back(i);
      if ((lli)i * i <= n)
        for (int j = i * i; j <= n; j += i) isprime[j] = false;
    }
  vector<vector<lli>> vec;
  int sqrtn = sqrt(n);
  for (int i = 0; i < (int)prime.size(); i++) {
    if (i % sqrtn == 0) vec.push_back({});
    vec.back().push_back(prime[i]);
  }
  lli ans = 1;
  int cnt = n;
  for (int i = 0; i < (int)vec.size(); i++) {
    int dem = 0;
    for (int j = 0; j < (int)vec[i].size(); j++) {
      if (ans * vec[i][j] > n) break;
      dem += ask('B', vec[i][j]);
    }
    int d = ask('A', 1);
    if (d + dem == cnt) {
      cnt -= dem;
      continue;
    }
    cnt = d;
    for (int j = 0; j < (int)vec[i].size(); j++) {
      lli t = vec[i][j];
      while (ans * vec[i][j] <= n && ask('A', t) > 0) {
        ans *= vec[i][j];
        t *= vec[i][j];
      }
    }
  }
  cout << 'C' << ' ' << ans << endl;
  return 0;
}
