#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
bool isPrime[N + 1];
void sieve(int N) {
  for (int i = 0; i <= N; ++i) {
    isPrime[i] = true;
  }
  isPrime[0] = false;
  isPrime[1] = false;
  for (int i = 2; i * i <= N; ++i) {
    if (isPrime[i] == true) {
      for (int j = i * i; j <= N; j += i) isPrime[j] = false;
    }
  }
}
void ask(char c, int x) {
  cout << c << " " << x << endl;
  cout.flush();
}
bool vis[N + 1];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  sieve(n);
  vector<int> prime;
  for (int i = 2; i <= n; i++) {
    if (isPrime[i]) prime.push_back(i);
  }
  vector<int> ans;
  for (auto v : prime) {
    int cnt = 0;
    for (int j = v; j <= n; j += v) {
      if (vis[j] == 0) {
        cnt++;
        vis[j] = 1;
      }
    }
    ans.push_back(cnt);
  }
  int res = 1;
  vector<int> u;
  int tmp = n, x;
  int count = 0;
  for (int v : prime) {
    if (v > 316)
      break;
    else {
      ask('B', v);
      cin >> x;
      tmp -= x;
      ask('A', v);
      cin >> x;
      if (x == 1) {
        u.push_back(v);
        tmp++;
      }
    }
  }
  vector<int> askk;
  for (int i = 0; i < prime.size(); i++) {
    if (prime[i] < 316) continue;
    count++;
    ask('B', prime[i]);
    cin >> x;
    if (x != ans[i]) {
      u.push_back(prime[i]);
      tmp -= (ans[i] - 1);
    } else {
      tmp -= ans[i];
      askk.push_back(prime[i]);
    }
    if (count % 100 == 99 || i == prime.size() - 1) {
      ask('A', 1);
      cin >> x;
      if (x != tmp) {
        tmp = x;
        for (auto v : askk) {
          ask('A', v);
          cin >> x;
          if (x != 0) {
            res *= v;
            break;
          }
        }
        break;
      }
      askk.clear();
    }
  }
  for (int v : u) {
    int t = v;
    while (1) {
      ask('A', t);
      cin >> x;
      if (x == 1) {
        if ((long long)t * v <= (long long)n)
          t *= v;
        else {
          break;
        }
      } else {
        t /= v;
        break;
      }
    }
    res *= t;
  }
  ask('C', res);
  return 0;
}
