//~ mail ID : neernpatel@gmail.com
//~ Author : DrexDelta
//~ codechef : drexdelta , hackerRank : drexdelta , codeforces : drexdelta1
//~ Contact Info : neernpatel@gmail.com

#include <iostream>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>

using namespace std;

#define F first
#define S second
#define MP make_pair
#define PB push_back
#define UB upper_bound
#define LB lower_bound
#define ER erase
#define EN end()
#define B begin()
#define I insert
#define OPTIMIZE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int ll
#define endl "\n"
#define CO cout <<
#define CI cin >>
#define NL cout << endl;
#define DBG {int debug ; cin >> debug;}
#define AND &&
#define OR ||
#define XOR ^
#define OFLUSH fflush(stdout);
#define IFLUSH fflush(stdin);
#define LEN(x) ((int)x.length())

#define rep(i,x) for(int i = 0 ; i < x ; i++)
#define rep1(i,x) for(int i = 1 ; i <= x ; i++)

#define repl(var,start_val,limit_val) for(int var = start_val ; var <= limit_val ; var++)
#define perl(var,start_val,limit_val) for(int var = start_val ; var >= limit_val ; var--)

#define y1 qwert
#define y2 trewq
#define x1 asdfg
#define x2 gfdsa

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< ii > vii;
typedef set<int> si;
typedef multiset<int> msi;
typedef long double ld;

const ll maxn = 1e5+6 ;
// const ll maxn = 12 ;
const ll MOD = 1e9 + 7 ;

bool comparator(int i , int j)
{
    return (i < j);
}

struct setCompare {
    bool operator() (const int64_t& lhs, const int64_t& rhs) const {
        // return s1.str() < s2.str();
    }
};

ll power(ll x, ll i)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%MOD;
		i >>=1;
		x = (x*x)%MOD;
	}
	return ans;
}

ll power(ll x, ll i,ll mod)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%mod;
		i >>=1;
		x = (x*x)%mod;
	}
	return ans;
}

ll modInverse(ll x, ll mod)
{
	return power(x , mod-2,mod);
}

bool isPalindrome(string s)
{
	int limit = s.length()/2;
	for(int i =  0 ; i < limit ; i++)
		if(s[i] != s[s.length()-i-1])
			return false;
	return true;
}

ll gcd(ll x, ll y)
{
	ll t;
	while(y != 0)
		t = x%y,x = y,y = t;
	return x;
}

bool isVowel(char ch){

    if(ch == 'a' || ch == 'i' || ch == 'e' || ch == 'u' || ch == 'o' || ch == 'y'){
        return true;
    }
    return false;
}

//////////////
// Geometry //
//////////////

ld getDisSquare(ld x1 ,ld y1,ld x2,ld y2){
	return ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

/////////////
bool isSquareHelper(int x1 , int y1 , int x2 , int y2 , int x3 , int y3 , int x4 , int y4){

	ld d1,d2,d3,d4,d5,d6;
	d1 = getDisSquare(x1,y1,x2,y2);
	d2 = getDisSquare(x2,y2,x3,y3);
	d3 = getDisSquare(x3,y3,x4,y4);
	d4 = getDisSquare(x4,y4,x1,y1);

	if(d1 == d2 && d1 == d3 && d1 == d4){

		d5 = getDisSquare(x1,y1,x3,y3);
		d6 = getDisSquare(x2,y2,x4,y4);
		if(d5 == d6){
			return 1;
		}

	}

	return 0;

}

// pass 4 points in any order,
// returns 1 if it forms square, else returns zero

bool isSquare(int x1 ,int y1 , int x2 , int y2 , int x3 , int y3 ,int x4 , int y4){

    if(	isSquareHelper(x1,y1,x2,y2,x3,y3,x4,y4) ||
    	isSquareHelper(x1,y1,x2,y2,x4,y4,x3,y3) ||
    	isSquareHelper(x1,y1,x3,y3,x2,y2,x4,y4)	)
    	return 1;
    else
    	return 0;

}

////////
bool isEqualateralTriangle(int x1, int y1,int x2, int y2, int x3, int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);
	if(d1 == d2 && d1 == d3){
		return 1;
	}
	else
		return 0;

}

// checking if , first piont is right angle
bool isRightAngleTriangleHelper(int x1, int y1 ,int x2 , int y2 , int x3 , int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);

	if(d2 == (d1 + d3)){
		return 1;
	}
	return 0;

}

bool isRightAngleTriangle(int x1, int y1, int x2 ,int y2 ,int x3 , int y3){

	if(isRightAngleTriangleHelper(x1,y1,x2,y2,x3,y3) ||
		isRightAngleTriangleHelper(x2,y2,x3,y3,x1,y1) ||
		  isRightAngleTriangleHelper(x3,y3,x1,y1,x2,y2))
		return 1;

	return 0;

}

bool areCollinear(int x1, int y1,int x2 , int y2 , int x3 , int y3){
	return ( (x3-x1)*(y2-y1) == (y3-y1)*(x2-x1));
}

/*
vi g[maxn];
int n , par[maxn];
vi traceBack(int node) {
    vi ret;
    while(par[node] != node) {
        ret.PB(node);
        node = par[node];
    }
    ret.PB(node);
    return ret;
}

// even if the grpah is disconnected, this function will return the cycle.
// define an array "par" , take graph input in "g" , number of nodes are "n", and
// parent of the starting node will be the beginning of the bfs... it returns only one cycle, in O ( n ) ;
// nodes are supposed to be in 1-index
vi getCycle() {
    vi ans;
    repl(i,1,n) {
        if (par[i] == -1) {
            par[i] = i;
            queue<int> q;
            q.push(i);
            bool foundCycle = false;
            while(q.size()) {
                auto fr = q.front();
                q.pop();
                for ( auto nbr : g[fr]) {
                    if (nbr != par[fr]) {
                        if (par[nbr] == -1) {
                            par[nbr] = fr;
                            q.push(nbr);
                        } else {
                            vi v1 = traceBack(fr);
                            vi v2 = traceBack(nbr);
                            map < int , int > m;
                            for ( auto i : v1 ) {
                                m[i] = 1;
                            }
                            int meetingPoint;
                            for ( auto i : v2 ) {
                                if(m[i]) {
                                    meetingPoint = i;break;
                                }
                            }
                            vi v11 , v22;
                            for ( auto i : v1) {
                                v11.PB(i);
                                if(i == meetingPoint)break;
                            }
                            for ( auto i : v2) {
                                v22.PB(i);
                                if(i == meetingPoint)break;
                            }

                            reverse(v22.begin(),v22.end());
                            int sz2 = v22.size();
                            repl(i,1,sz2-1) {
                                v11.PB(v22[i]);
                            }
                            NL
                            return v11;
                            foundCycle = true; // we actually never reach here... we return // in case we need to have some other flow, we can do it...
                            break;
                        }
                    }
                }
                if(foundCycle) { // never in this condition
                    break;
                }
            }
        }
    }
    return ans;
}
*/

// eratoshenes sieve ...
// Once eratoshtenes is activated, use the isPrime function below it,
// and deactivate above function

int lp[maxn];
vector<int> pr;
void generatePrimes()
{
	for (int i=2; i<=maxn; ++i)
	{
		if (lp[i] == 0)
		{
			lp[i] = i;
			pr.push_back (i);
		}
		for (unsigned j=0; j<pr.size() && pr[j]<=lp[i] && i*pr[j]<maxn;)
		{
			lp[i * pr[j]] = pr[j];
			j++;
		}
	}
	return;
}

bool isPrime(int n)
{
	int root = sqrt(n);
	for(int i = 0 ; i < pr.size() && pr[i] <= root ; i++) if(n%pr[i] == 0) return 0;
	return 1;
}

/////////////////////////
// declaration section //
/////////////////////////

si s;
int n,x,tot,f[maxn];

void getInput() {
    cin >> n;
    OFLUSH IFLUSH
    repl(i,1,n) s.I(i);
    tot = n;
}

int TypeB(int i) {
    tot++;
    int ret;
    cout << "B " << i ; NL
    OFLUSH
    cin >> ret;
    return ret;
}

int TypeA(int i) {
    tot++;
    int ret;
    cout << "A " << i ; NL
    OFLUSH
    cin >> ret;
    return ret;
}

void solve() {
    vi ans;
    bool foundSmallest = false;

    for ( int k = 0 ; k < pr.size();) {
        int i = pr[k];
        if (i > n) break;
        int cnt = 0;
        int cnt2;
        int vall = i;
        repl(j,1,n+1) {
            if (!f[vall]) {
                cnt++;
                f[vall] = 1;
            }
            vall += i;
            if(vall > n)break;
        }
        cnt2 = TypeB(i);
        if(cnt != cnt2) {
            ans.PB(i);
        }
        k++;
        if (k % 100 == 99 || k == pr.size() || pr[k] > n ) {
            cnt2 = TypeA(1);
            cnt = s.size();
            if(cnt2 != cnt) {
                int kk = max((int)k - (int)99,(int)0);
                while(1) {
                    cnt2 = TypeA(pr[kk]);
                    if(cnt2) {
                        ans.PB(pr[kk]);
                        break;
                    }
                    kk++;
                    if(kk == pr.size())break;
                }
                foundSmallest = true;
            }
        }
        if(pr[k] > n) break;
    }
    int finalAns = 1;
    int mul;
    int cnt2;
    for ( auto i : ans) {
        mul = i;
        while(1) {
            cnt2 = TypeA(mul*i);
            if(cnt2 == 0)break;
            mul = mul*i;
        }
        finalAns = mul * finalAns;
    }
    cout << "C " << finalAns << endl;
}
signed main() {

    generatePrimes();

    //freopen("in.txt" , "r" , stdin) ;
    //freopen("out.txt" , "w" , stdout) ;

    int t=1;
    // cin >> t;
    while(t--)
        getInput() , solve();

	return 0;
}


//~ mail ID : neernpatel@gmail.com
//~ Author : DrexDelta
//~ codechef : drexdelta , hackerRank : drexdelta , codeforces : drexdelta1
//~ Contact Info : neernpatel@gmail.com

#include <iostream>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>

using namespace std;

#define F first
#define S second
#define MP make_pair
#define PB push_back
#define UB upper_bound
#define LB lower_bound
#define ER erase
#define EN end()
#define B begin()
#define I insert
#define OPTIMIZE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int ll
#define endl "\n"
#define CO cout <<
#define CI cin >>
#define NL cout << endl;
#define DBG {int debug ; cin >> debug;}
#define AND &&
#define OR ||
#define XOR ^
#define OFLUSH fflush(stdout);
#define IFLUSH fflush(stdin);
#define LEN(x) ((int)x.length())

#define rep(i,x) for(int i = 0 ; i < x ; i++)
#define rep1(i,x) for(int i = 1 ; i <= x ; i++)

#define repl(var,start_val,limit_val) for(int var = start_val ; var <= limit_val ; var++)
#define perl(var,start_val,limit_val) for(int var = start_val ; var >= limit_val ; var--)

#define y1 qwert
#define y2 trewq
#define x1 asdfg
#define x2 gfdsa

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< ii > vii;
typedef set<int> si;
typedef multiset<int> msi;
typedef long double ld;

const ll maxn = 1e5+6 ;
// const ll maxn = 12 ;
const ll MOD = 1e9 + 7 ;

bool comparator(int i , int j)
{
    return (i < j);
}

struct setCompare {
    bool operator() (const int64_t& lhs, const int64_t& rhs) const {
        // return s1.str() < s2.str();
    }
};

ll power(ll x, ll i)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%MOD;
		i >>=1;
		x = (x*x)%MOD;
	}
	return ans;
}

ll power(ll x, ll i,ll mod)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%mod;
		i >>=1;
		x = (x*x)%mod;
	}
	return ans;
}

ll modInverse(ll x, ll mod)
{
	return power(x , mod-2,mod);
}

bool isPalindrome(string s)
{
	int limit = s.length()/2;
	for(int i =  0 ; i < limit ; i++)
		if(s[i] != s[s.length()-i-1])
			return false;
	return true;
}

ll gcd(ll x, ll y)
{
	ll t;
	while(y != 0)
		t = x%y,x = y,y = t;
	return x;
}

bool isVowel(char ch){

    if(ch == 'a' || ch == 'i' || ch == 'e' || ch == 'u' || ch == 'o' || ch == 'y'){
        return true;
    }
    return false;
}

//////////////
// Geometry //
//////////////

ld getDisSquare(ld x1 ,ld y1,ld x2,ld y2){
	return ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

/////////////
bool isSquareHelper(int x1 , int y1 , int x2 , int y2 , int x3 , int y3 , int x4 , int y4){

	ld d1,d2,d3,d4,d5,d6;
	d1 = getDisSquare(x1,y1,x2,y2);
	d2 = getDisSquare(x2,y2,x3,y3);
	d3 = getDisSquare(x3,y3,x4,y4);
	d4 = getDisSquare(x4,y4,x1,y1);

	if(d1 == d2 && d1 == d3 && d1 == d4){

		d5 = getDisSquare(x1,y1,x3,y3);
		d6 = getDisSquare(x2,y2,x4,y4);
		if(d5 == d6){
			return 1;
		}

	}

	return 0;

}

// pass 4 points in any order,
// returns 1 if it forms square, else returns zero

bool isSquare(int x1 ,int y1 , int x2 , int y2 , int x3 , int y3 ,int x4 , int y4){

    if(	isSquareHelper(x1,y1,x2,y2,x3,y3,x4,y4) ||
    	isSquareHelper(x1,y1,x2,y2,x4,y4,x3,y3) ||
    	isSquareHelper(x1,y1,x3,y3,x2,y2,x4,y4)	)
    	return 1;
    else
    	return 0;

}

////////
bool isEqualateralTriangle(int x1, int y1,int x2, int y2, int x3, int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);
	if(d1 == d2 && d1 == d3){
		return 1;
	}
	else
		return 0;

}

// checking if , first piont is right angle
bool isRightAngleTriangleHelper(int x1, int y1 ,int x2 , int y2 , int x3 , int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);

	if(d2 == (d1 + d3)){
		return 1;
	}
	return 0;

}

bool isRightAngleTriangle(int x1, int y1, int x2 ,int y2 ,int x3 , int y3){

	if(isRightAngleTriangleHelper(x1,y1,x2,y2,x3,y3) ||
		isRightAngleTriangleHelper(x2,y2,x3,y3,x1,y1) ||
		  isRightAngleTriangleHelper(x3,y3,x1,y1,x2,y2))
		return 1;

	return 0;

}

bool areCollinear(int x1, int y1,int x2 , int y2 , int x3 , int y3){
	return ( (x3-x1)*(y2-y1) == (y3-y1)*(x2-x1));
}

/*
vi g[maxn];
int n , par[maxn];
vi traceBack(int node) {
    vi ret;
    while(par[node] != node) {
        ret.PB(node);
        node = par[node];
    }
    ret.PB(node);
    return ret;
}

// even if the grpah is disconnected, this function will return the cycle.
// define an array "par" , take graph input in "g" , number of nodes are "n", and
// parent of the starting node will be the beginning of the bfs... it returns only one cycle, in O ( n ) ;
// nodes are supposed to be in 1-index
vi getCycle() {
    vi ans;
    repl(i,1,n) {
        if (par[i] == -1) {
            par[i] = i;
            queue<int> q;
            q.push(i);
            bool foundCycle = false;
            while(q.size()) {
                auto fr = q.front();
                q.pop();
                for ( auto nbr : g[fr]) {
                    if (nbr != par[fr]) {
                        if (par[nbr] == -1) {
                            par[nbr] = fr;
                            q.push(nbr);
                        } else {
                            vi v1 = traceBack(fr);
                            vi v2 = traceBack(nbr);
                            map < int , int > m;
                            for ( auto i : v1 ) {
                                m[i] = 1;
                            }
                            int meetingPoint;
                            for ( auto i : v2 ) {
                                if(m[i]) {
                                    meetingPoint = i;break;
                                }
                            }
                            vi v11 , v22;
                            for ( auto i : v1) {
                                v11.PB(i);
                                if(i == meetingPoint)break;
                            }
                            for ( auto i : v2) {
                                v22.PB(i);
                                if(i == meetingPoint)break;
                            }

                            reverse(v22.begin(),v22.end());
                            int sz2 = v22.size();
                            repl(i,1,sz2-1) {
                                v11.PB(v22[i]);
                            }
                            NL
                            return v11;
                            foundCycle = true; // we actually never reach here... we return // in case we need to have some other flow, we can do it...
                            break;
                        }
                    }
                }
                if(foundCycle) { // never in this condition
                    break;
                }
            }
        }
    }
    return ans;
}
*/

// eratoshenes sieve ...
// Once eratoshtenes is activated, use the isPrime function below it,
// and deactivate above function

int lp[maxn];
vector<int> pr;
void generatePrimes()
{
	for (int i=2; i<=maxn; ++i)
	{
		if (lp[i] == 0)
		{
			lp[i] = i;
			pr.push_back (i);
		}
		for (unsigned j=0; j<pr.size() && pr[j]<=lp[i] && i*pr[j]<maxn;)
		{
			lp[i * pr[j]] = pr[j];
			j++;
		}
	}
	return;
}

bool isPrime(int n)
{
	int root = sqrt(n);
	for(int i = 0 ; i < pr.size() && pr[i] <= root ; i++) if(n%pr[i] == 0) return 0;
	return 1;
}

/////////////////////////
// declaration section //
/////////////////////////

si s;
int n,x,tot,f[maxn],q=0;

void getInput() {
    cin >> n;
    // cin >> x;
    OFLUSH IFLUSH
    repl(i,1,n) s.I(i);
    tot = n;
}

int TypeB(int i) {
    int ret=0;
    cout << "B " << i ; NL
    OFLUSH
    cin >> ret;

    // rep(j,n) {
    //     if(j*i>n)break;
    //     if(s.find(j*i) != s.end()) {
    //         ret++;
    //     }
    //     if(x != j*i) {
    //         s.ER(j*i);
    //     }
    // }
    // cout << ret << endl;
    return ret;
}

int TypeA(int i) {
    int ret=0;
    cout << "A " << i ; NL
    OFLUSH
    cin >> ret;
    // rep(j,n) {
    //     if(j*i>n)break;
    //     if(s.find(j*i) != s.end()) {
    //         ret++;
    //     }
    // }
    // cout << ret << endl;
    return ret;
}

void solve() {
    vi ans;
    bool foundSmallest = false;

    for ( int k = 0 ; k < pr.size();) {
        int i = pr[k];
        if (i > n) break;
        int cnt = 0;
        int cnt2;
        int vall = i;
        repl(j,1,n+1) {
            if (!f[vall]) {
                cnt++;
                f[vall] = 1;
                tot--;
            }
            vall += i;
            if(vall > n)break;
        }
        cnt2 = TypeB(i);
        if(cnt != cnt2) {
            ans.PB(i);
        }
        k++;
        if (k % 100 == 99 || k == pr.size() || pr[k] > n ) {
            cnt2 = TypeA(1);
            cnt = tot;
            if(cnt2 != cnt) {
                int kk = max((int)k - (int)99,(int)0);
                while(1) {
                    cnt2 = TypeA(pr[kk]);
                    if(cnt2) {
                        ans.PB(pr[kk]);
                        break;
                    }
                    kk++;
                    if(kk == pr.size())break;
                    if(pr[kk] > n) break;
                }
                foundSmallest = true;
            }
        }
        if(pr[k] > n) break;
    }
    int finalAns = 1;
    int mul;
    int cnt2;
    for ( auto i : ans) {
        mul = i;
        while(1) {
            if(mul*i > n)break;
            cnt2 = TypeA(mul*i);
            if(cnt2 == 0)break;
            mul = mul*i;
        }
        finalAns = mul * finalAns;
    }
    cout << "C " << finalAns << endl;
    // cout << q << endl;
}
signed main() {

    generatePrimes();

    //freopen("in.txt" , "r" , stdin) ;
    //freopen("out.txt" , "w" , stdout) ;

    int t=1;
    // cin >> t;
    while(t--)
        getInput() , solve();

	return 0;
}


//~ mail ID : neernpatel@gmail.com
//~ Author : DrexDelta
//~ codechef : drexdelta , hackerRank : drexdelta , codeforces : drexdelta1
//~ Contact Info : neernpatel@gmail.com

#include <iostream>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>

using namespace std;

#define F first
#define S second
#define MP make_pair
#define PB push_back
#define UB upper_bound
#define LB lower_bound
#define ER erase
#define EN end()
#define B begin()
#define I insert
#define OPTIMIZE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int ll
#define endl "\n"
#define CO cout <<
#define CI cin >>
#define NL cout << endl;
#define DBG {int debug ; cin >> debug;}
#define AND &&
#define OR ||
#define XOR ^
#define OFLUSH fflush(stdout);
#define IFLUSH fflush(stdin);
#define LEN(x) ((int)x.length())

#define rep(i,x) for(int i = 0 ; i < x ; i++)
#define rep1(i,x) for(int i = 1 ; i <= x ; i++)

#define repl(var,start_val,limit_val) for(int var = start_val ; var <= limit_val ; var++)
#define perl(var,start_val,limit_val) for(int var = start_val ; var >= limit_val ; var--)

#define y1 qwert
#define y2 trewq
#define x1 asdfg
#define x2 gfdsa

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< ii > vii;
typedef set<int> si;
typedef multiset<int> msi;
typedef long double ld;

const ll maxn = 1e5+6 ;
const ll MOD = 1e9 + 7 ;

bool comparator(int i , int j)
{
    return (i < j);
}

struct setCompare {
    bool operator() (const int64_t& lhs, const int64_t& rhs) const {
        // return s1.str() < s2.str();
    }
};

ll power(ll x, ll i)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%MOD;
		i >>=1;
		x = (x*x)%MOD;
	}
	return ans;
}

ll power(ll x, ll i,ll mod)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%mod;
		i >>=1;
		x = (x*x)%mod;
	}
	return ans;
}

ll modInverse(ll x, ll mod)
{
	return power(x , mod-2,mod);
}

bool isPalindrome(string s)
{
	int limit = s.length()/2;
	for(int i =  0 ; i < limit ; i++)
		if(s[i] != s[s.length()-i-1])
			return false;
	return true;
}

ll gcd(ll x, ll y)
{
	ll t;
	while(y != 0)
		t = x%y,x = y,y = t;
	return x;
}

bool isVowel(char ch){

    if(ch == 'a' || ch == 'i' || ch == 'e' || ch == 'u' || ch == 'o' || ch == 'y'){
        return true;
    }
    return false;
}

//////////////
// Geometry //
//////////////

ld getDisSquare(ld x1 ,ld y1,ld x2,ld y2){
	return ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

/////////////
bool isSquareHelper(int x1 , int y1 , int x2 , int y2 , int x3 , int y3 , int x4 , int y4){

	ld d1,d2,d3,d4,d5,d6;
	d1 = getDisSquare(x1,y1,x2,y2);
	d2 = getDisSquare(x2,y2,x3,y3);
	d3 = getDisSquare(x3,y3,x4,y4);
	d4 = getDisSquare(x4,y4,x1,y1);

	if(d1 == d2 && d1 == d3 && d1 == d4){

		d5 = getDisSquare(x1,y1,x3,y3);
		d6 = getDisSquare(x2,y2,x4,y4);
		if(d5 == d6){
			return 1;
		}

	}

	return 0;

}

// pass 4 points in any order,
// returns 1 if it forms square, else returns zero

bool isSquare(int x1 ,int y1 , int x2 , int y2 , int x3 , int y3 ,int x4 , int y4){

    if(	isSquareHelper(x1,y1,x2,y2,x3,y3,x4,y4) ||
    	isSquareHelper(x1,y1,x2,y2,x4,y4,x3,y3) ||
    	isSquareHelper(x1,y1,x3,y3,x2,y2,x4,y4)	)
    	return 1;
    else
    	return 0;

}

////////
bool isEqualateralTriangle(int x1, int y1,int x2, int y2, int x3, int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);
	if(d1 == d2 && d1 == d3){
		return 1;
	}
	else
		return 0;

}

// checking if , first piont is right angle
bool isRightAngleTriangleHelper(int x1, int y1 ,int x2 , int y2 , int x3 , int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);

	if(d2 == (d1 + d3)){
		return 1;
	}
	return 0;

}

bool isRightAngleTriangle(int x1, int y1, int x2 ,int y2 ,int x3 , int y3){

	if(isRightAngleTriangleHelper(x1,y1,x2,y2,x3,y3) ||
		isRightAngleTriangleHelper(x2,y2,x3,y3,x1,y1) ||
		  isRightAngleTriangleHelper(x3,y3,x1,y1,x2,y2))
		return 1;

	return 0;

}

bool areCollinear(int x1, int y1,int x2 , int y2 , int x3 , int y3){
	return ( (x3-x1)*(y2-y1) == (y3-y1)*(x2-x1));
}

/*
vi g[maxn];
int n , par[maxn];
vi traceBack(int node) {
    vi ret;
    while(par[node] != node) {
        ret.PB(node);
        node = par[node];
    }
    ret.PB(node);
    return ret;
}

// even if the grpah is disconnected, this function will return the cycle.
// define an array "par" , take graph input in "g" , number of nodes are "n", and
// parent of the starting node will be the beginning of the bfs... it returns only one cycle, in O ( n ) ;
// nodes are supposed to be in 1-index
vi getCycle() {
    vi ans;
    repl(i,1,n) {
        if (par[i] == -1) {
            par[i] = i;
            queue<int> q;
            q.push(i);
            bool foundCycle = false;
            while(q.size()) {
                auto fr = q.front();
                q.pop();
                for ( auto nbr : g[fr]) {
                    if (nbr != par[fr]) {
                        if (par[nbr] == -1) {
                            par[nbr] = fr;
                            q.push(nbr);
                        } else {
                            vi v1 = traceBack(fr);
                            vi v2 = traceBack(nbr);
                            map < int , int > m;
                            for ( auto i : v1 ) {
                                m[i] = 1;
                            }
                            int meetingPoint;
                            for ( auto i : v2 ) {
                                if(m[i]) {
                                    meetingPoint = i;break;
                                }
                            }
                            vi v11 , v22;
                            for ( auto i : v1) {
                                v11.PB(i);
                                if(i == meetingPoint)break;
                            }
                            for ( auto i : v2) {
                                v22.PB(i);
                                if(i == meetingPoint)break;
                            }

                            reverse(v22.begin(),v22.end());
                            int sz2 = v22.size();
                            repl(i,1,sz2-1) {
                                v11.PB(v22[i]);
                            }
                            NL
                            return v11;
                            foundCycle = true; // we actually never reach here... we return // in case we need to have some other flow, we can do it...
                            break;
                        }
                    }
                }
                if(foundCycle) { // never in this condition
                    break;
                }
            }
        }
    }
    return ans;
}
*/

// eratoshenes sieve ...
// Once eratoshtenes is activated, use the isPrime function below it,
// and deactivate above function

int lp[maxn];
vector<int> pr;
void generatePrimes()
{
	for (int i=2; i<=maxn; ++i)
	{
		if (lp[i] == 0)
		{
			lp[i] = i;
			pr.push_back (i);
		}
		for (unsigned j=0; j<pr.size() && pr[j]<=lp[i] && i*pr[j]<maxn;)
		{
			lp[i * pr[j]] = pr[j];
			j++;
		}
	}
	return;
}

bool isPrime(int n)
{
	int root = sqrt(n);
	for(int i = 0 ; i < pr.size() && pr[i] <= root ; i++) if(n%pr[i] == 0) return 0;
	return 1;
}

/////////////////////////
// declaration section //
/////////////////////////

si s;
int n;

void getInput() {
    cin >> n;
    repl(i,1,n) s.I(i);
}

void solve() {
    vi ans;
    bool foundSmallest = false;

    for ( int k = 0 ; k < pr.size() ; ) {

        int i = pr[k];
        if (i > n) break;
        int cnt = 0;
        int cnt2;
        repl(j,1,n+1) {
            auto it = s.find(j*i);
            if( it != s.end()) cnt++, s.ER(it);
            if(j*i > n)break;
        }
        cout << "B " << i ; NL
        OFLUSH IFLUSH
        cin >> cnt2;
        IFLUSH OFLUSH
        if(cnt != cnt2) {
            ans.PB(i);
        }
        k++;
        if (k == pr.size() || k % 100 == 99 || pr[k] > n) {
            cout << "A 1" << endl;
            OFLUSH IFLUSH
            cin >> cnt2;
            IFLUSH OFLUSH
            cnt = s.size();
            if(cnt2 != cnt) {
                int kk = max((int)k - (int)99,(int)0);
                while(1) {
                    cout << "A " << pr[kk] ; NL
                    OFLUSH IFLUSH
                    cin >> cnt2;
                    IFLUSH OFLUSH
                    if(cnt2) {
                        ans.PB(pr[kk]);
                        break;
                    }
                    kk++;
                }
                foundSmallest = true;
            }
            break;
        }
        if(pr[k] > n) break;
    }
    int finalAns = 1;
    int mul;
    int cnt2;
    for ( auto i : ans) {
        mul = i;
        while(1) {
            cout << "A " << mul*i ; NL
            OFLUSH IFLUSH
            cin >> cnt2;
            IFLUSH OFLUSH
            if(cnt2 == 0)break;
            mul = mul*i;
        }
        finalAns = mul * finalAns;
    }
    cout << "C " << finalAns << endl;
}
signed main() {

    OPTIMIZE
    generatePrimes();

    //freopen("in.txt" , "r" , stdin) ;
    //freopen("out.txt" , "w" , stdout) ;

    int t=1;
    // cin >> t;
    while(t--)
        getInput() , solve();

	return 0;
}


//~ mail ID : neernpatel@gmail.com
//~ Author : DrexDelta
//~ codechef : drexdelta , hackerRank : drexdelta , codeforces : drexdelta1
//~ Contact Info : neernpatel@gmail.com

#include <iostream>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>

using namespace std;

#define F first
#define S second
#define MP make_pair
#define PB push_back
#define UB upper_bound
#define LB lower_bound
#define ER erase
#define EN end()
#define B begin()
#define I insert
#define OPTIMIZE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int ll
#define endl "\n"
#define CO cout <<
#define CI cin >>
#define NL cout << endl;
#define DBG {int debug ; cin >> debug;}
#define AND &&
#define OR ||
#define XOR ^
#define OFLUSH fflush(stdout);
#define IFLUSH fflush(stdin);
#define LEN(x) ((int)x.length())

#define rep(i,x) for(int i = 0 ; i < x ; i++)
#define rep1(i,x) for(int i = 1 ; i <= x ; i++)

#define repl(var,start_val,limit_val) for(int var = start_val ; var <= limit_val ; var++)
#define perl(var,start_val,limit_val) for(int var = start_val ; var >= limit_val ; var--)

#define y1 qwert
#define y2 trewq
#define x1 asdfg
#define x2 gfdsa

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< ii > vii;
typedef set<int> si;
typedef multiset<int> msi;
typedef long double ld;

const ll maxn = 1e5+6 ;
// const ll maxn = 12 ;
const ll MOD = 1e9 + 7 ;

bool comparator(int i , int j)
{
    return (i < j);
}

struct setCompare {
    bool operator() (const int64_t& lhs, const int64_t& rhs) const {
        // return s1.str() < s2.str();
    }
};

ll power(ll x, ll i)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%MOD;
		i >>=1;
		x = (x*x)%MOD;
	}
	return ans;
}

ll power(ll x, ll i,ll mod)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%mod;
		i >>=1;
		x = (x*x)%mod;
	}
	return ans;
}

ll modInverse(ll x, ll mod)
{
	return power(x , mod-2,mod);
}

bool isPalindrome(string s)
{
	int limit = s.length()/2;
	for(int i =  0 ; i < limit ; i++)
		if(s[i] != s[s.length()-i-1])
			return false;
	return true;
}

ll gcd(ll x, ll y)
{
	ll t;
	while(y != 0)
		t = x%y,x = y,y = t;
	return x;
}

bool isVowel(char ch){

    if(ch == 'a' || ch == 'i' || ch == 'e' || ch == 'u' || ch == 'o' || ch == 'y'){
        return true;
    }
    return false;
}

//////////////
// Geometry //
//////////////

ld getDisSquare(ld x1 ,ld y1,ld x2,ld y2){
	return ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

/////////////
bool isSquareHelper(int x1 , int y1 , int x2 , int y2 , int x3 , int y3 , int x4 , int y4){

	ld d1,d2,d3,d4,d5,d6;
	d1 = getDisSquare(x1,y1,x2,y2);
	d2 = getDisSquare(x2,y2,x3,y3);
	d3 = getDisSquare(x3,y3,x4,y4);
	d4 = getDisSquare(x4,y4,x1,y1);

	if(d1 == d2 && d1 == d3 && d1 == d4){

		d5 = getDisSquare(x1,y1,x3,y3);
		d6 = getDisSquare(x2,y2,x4,y4);
		if(d5 == d6){
			return 1;
		}

	}

	return 0;

}

// pass 4 points in any order,
// returns 1 if it forms square, else returns zero

bool isSquare(int x1 ,int y1 , int x2 , int y2 , int x3 , int y3 ,int x4 , int y4){

    if(	isSquareHelper(x1,y1,x2,y2,x3,y3,x4,y4) ||
    	isSquareHelper(x1,y1,x2,y2,x4,y4,x3,y3) ||
    	isSquareHelper(x1,y1,x3,y3,x2,y2,x4,y4)	)
    	return 1;
    else
    	return 0;

}

////////
bool isEqualateralTriangle(int x1, int y1,int x2, int y2, int x3, int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);
	if(d1 == d2 && d1 == d3){
		return 1;
	}
	else
		return 0;

}

// checking if , first piont is right angle
bool isRightAngleTriangleHelper(int x1, int y1 ,int x2 , int y2 , int x3 , int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);

	if(d2 == (d1 + d3)){
		return 1;
	}
	return 0;

}

bool isRightAngleTriangle(int x1, int y1, int x2 ,int y2 ,int x3 , int y3){

	if(isRightAngleTriangleHelper(x1,y1,x2,y2,x3,y3) ||
		isRightAngleTriangleHelper(x2,y2,x3,y3,x1,y1) ||
		  isRightAngleTriangleHelper(x3,y3,x1,y1,x2,y2))
		return 1;

	return 0;

}

bool areCollinear(int x1, int y1,int x2 , int y2 , int x3 , int y3){
	return ( (x3-x1)*(y2-y1) == (y3-y1)*(x2-x1));
}

/*
vi g[maxn];
int n , par[maxn];
vi traceBack(int node) {
    vi ret;
    while(par[node] != node) {
        ret.PB(node);
        node = par[node];
    }
    ret.PB(node);
    return ret;
}

// even if the grpah is disconnected, this function will return the cycle.
// define an array "par" , take graph input in "g" , number of nodes are "n", and
// parent of the starting node will be the beginning of the bfs... it returns only one cycle, in O ( n ) ;
// nodes are supposed to be in 1-index
vi getCycle() {
    vi ans;
    repl(i,1,n) {
        if (par[i] == -1) {
            par[i] = i;
            queue<int> q;
            q.push(i);
            bool foundCycle = false;
            while(q.size()) {
                auto fr = q.front();
                q.pop();
                for ( auto nbr : g[fr]) {
                    if (nbr != par[fr]) {
                        if (par[nbr] == -1) {
                            par[nbr] = fr;
                            q.push(nbr);
                        } else {
                            vi v1 = traceBack(fr);
                            vi v2 = traceBack(nbr);
                            map < int , int > m;
                            for ( auto i : v1 ) {
                                m[i] = 1;
                            }
                            int meetingPoint;
                            for ( auto i : v2 ) {
                                if(m[i]) {
                                    meetingPoint = i;break;
                                }
                            }
                            vi v11 , v22;
                            for ( auto i : v1) {
                                v11.PB(i);
                                if(i == meetingPoint)break;
                            }
                            for ( auto i : v2) {
                                v22.PB(i);
                                if(i == meetingPoint)break;
                            }

                            reverse(v22.begin(),v22.end());
                            int sz2 = v22.size();
                            repl(i,1,sz2-1) {
                                v11.PB(v22[i]);
                            }
                            NL
                            return v11;
                            foundCycle = true; // we actually never reach here... we return // in case we need to have some other flow, we can do it...
                            break;
                        }
                    }
                }
                if(foundCycle) { // never in this condition
                    break;
                }
            }
        }
    }
    return ans;
}
*/

// eratoshenes sieve ...
// Once eratoshtenes is activated, use the isPrime function below it,
// and deactivate above function

int lp[maxn];
vector<int> pr;
void generatePrimes()
{
	for (int i=2; i<=maxn; ++i)
	{
		if (lp[i] == 0)
		{
			lp[i] = i;
			pr.push_back (i);
		}
		for (unsigned j=0; j<pr.size() && pr[j]<=lp[i] && i*pr[j]<maxn;)
		{
			lp[i * pr[j]] = pr[j];
			j++;
		}
	}
	return;
}

bool isPrime(int n)
{
	int root = sqrt(n);
	for(int i = 0 ; i < pr.size() && pr[i] <= root ; i++) if(n%pr[i] == 0) return 0;
	return 1;
}

/////////////////////////
// declaration section //
/////////////////////////

si s;
int n,x,tot,f[maxn],q=0;

void getInput() {
    cin >> n;
    // cin >> x;
    OFLUSH IFLUSH
    // repl(i,1,n) s.I(i);
    tot = n;
}

int TypeB(int i) {
    q++;
    int ret=0;
    cout << "B " << i ; NL
    OFLUSH
    cin >> ret;

    // rep(j,n) {
    //     if(j*i>n)break;
    //     if(s.find(j*i) != s.end()) {
    //         ret++;
    //     }
    //     if(x != j*i) {
    //         s.ER(j*i);
    //     }
    // }
    // cout << ret << endl;
    return ret;
}

int TypeA(int i) {
    q++;
    int ret=0;
    cout << "A " << i ; NL
    OFLUSH
    cin >> ret;
    // rep(j,n) {
    //     if(j*i>n)break;
    //     if(s.find(j*i) != s.end()) {
    //         ret++;
    //     }
    // }
    // cout << ret << endl;
    return ret;
}

void solve() {
    vi ans;
    bool foundSmallest = false;

    for ( int k = 0 ; k < pr.size();) {
        int i = pr[k];
        if (i > n) break;
        int cnt = 0;
        int cnt2;
        int vall = i;
        repl(j,1,n+1) {
            if (!f[vall]) {
                cnt++;
                f[vall] = 1;
                tot--;
            }
            vall += i;
            if(vall > n)break;
        }
        cnt2 = TypeB(i);
        if(cnt != cnt2) {
            ans.PB(i);
        }
        k++;
        if (foundSmallest == 0 && (k % 100 == 99 || k == pr.size() || pr[k] > n )) {
            cnt2 = TypeA(1);
            cnt = tot;
            if(cnt2 != cnt) {
                int kk = max((int)k - (int)99,(int)0);
                while(1) {
                    cnt2 = TypeA(pr[kk]);
                    if(cnt2) {
                        ans.PB(pr[kk]);
                        break;
                    }
                    kk++;
                    if(kk == pr.size())break;
                    if(pr[kk] > n) break;
                }
                foundSmallest = true;
            }
        }
        if(pr[k] > n) break;
    }
    // cout << "prime facrtors " << NL;
    // for ( auto i : ans ) {
    //     CO i << " ";
    // }
    // NL NL NL
    int finalAns = 1;
    int mul;
    int cnt2;
    for ( auto i : ans) {
        mul = i;
        while(1) {
            if(mul*i > n)break;
            cnt2 = TypeA(mul*i);
            if(cnt2 == 0)break;
            mul = mul*i;
        }
        finalAns = mul * finalAns;
    }
    cout << "C " << finalAns << endl;
    cout << q << endl;
}
signed main() {

    generatePrimes();

    //freopen("in.txt" , "r" , stdin) ;
    //freopen("out.txt" , "w" , stdout) ;

    int t=1;
    // cin >> t;
    while(t--)
        getInput() , solve();

	return 0;
}


//~ mail ID : neernpatel@gmail.com
//~ Author : DrexDelta
//~ codechef : drexdelta , hackerRank : drexdelta , codeforces : drexdelta1
//~ Contact Info : neernpatel@gmail.com

#include <iostream>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>

using namespace std;

#define F first
#define S second
#define MP make_pair
#define PB push_back
#define UB upper_bound
#define LB lower_bound
#define ER erase
#define EN end()
#define B begin()
#define I insert
#define OPTIMIZE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int ll
#define endl "\n"
#define CO cout <<
#define CI cin >>
#define NL cout << endl;
#define DBG {int debug ; cin >> debug;}
#define AND &&
#define OR ||
#define XOR ^
#define OFLUSH fflush(stdout);
#define IFLUSH fflush(stdin);
#define LEN(x) ((int)x.length())

#define rep(i,x) for(int i = 0 ; i < x ; i++)
#define rep1(i,x) for(int i = 1 ; i <= x ; i++)

#define repl(var,start_val,limit_val) for(int var = start_val ; var <= limit_val ; var++)
#define perl(var,start_val,limit_val) for(int var = start_val ; var >= limit_val ; var--)

#define y1 qwert
#define y2 trewq
#define x1 asdfg
#define x2 gfdsa

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< ii > vii;
typedef set<int> si;
typedef multiset<int> msi;
typedef long double ld;

const ll maxn = 1e5+6 ;
// const ll maxn = 12 ;
const ll MOD = 1e9 + 7 ;

bool comparator(int i , int j)
{
    return (i < j);
}

struct setCompare {
    bool operator() (const int64_t& lhs, const int64_t& rhs) const {
        // return s1.str() < s2.str();
    }
};

ll power(ll x, ll i)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%MOD;
		i >>=1;
		x = (x*x)%MOD;
	}
	return ans;
}

ll power(ll x, ll i,ll mod)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%mod;
		i >>=1;
		x = (x*x)%mod;
	}
	return ans;
}

ll modInverse(ll x, ll mod)
{
	return power(x , mod-2,mod);
}

bool isPalindrome(string s)
{
	int limit = s.length()/2;
	for(int i =  0 ; i < limit ; i++)
		if(s[i] != s[s.length()-i-1])
			return false;
	return true;
}

ll gcd(ll x, ll y)
{
	ll t;
	while(y != 0)
		t = x%y,x = y,y = t;
	return x;
}

bool isVowel(char ch){

    if(ch == 'a' || ch == 'i' || ch == 'e' || ch == 'u' || ch == 'o' || ch == 'y'){
        return true;
    }
    return false;
}

//////////////
// Geometry //
//////////////

ld getDisSquare(ld x1 ,ld y1,ld x2,ld y2){
	return ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

/////////////
bool isSquareHelper(int x1 , int y1 , int x2 , int y2 , int x3 , int y3 , int x4 , int y4){

	ld d1,d2,d3,d4,d5,d6;
	d1 = getDisSquare(x1,y1,x2,y2);
	d2 = getDisSquare(x2,y2,x3,y3);
	d3 = getDisSquare(x3,y3,x4,y4);
	d4 = getDisSquare(x4,y4,x1,y1);

	if(d1 == d2 && d1 == d3 && d1 == d4){

		d5 = getDisSquare(x1,y1,x3,y3);
		d6 = getDisSquare(x2,y2,x4,y4);
		if(d5 == d6){
			return 1;
		}

	}

	return 0;

}

// pass 4 points in any order,
// returns 1 if it forms square, else returns zero

bool isSquare(int x1 ,int y1 , int x2 , int y2 , int x3 , int y3 ,int x4 , int y4){

    if(	isSquareHelper(x1,y1,x2,y2,x3,y3,x4,y4) ||
    	isSquareHelper(x1,y1,x2,y2,x4,y4,x3,y3) ||
    	isSquareHelper(x1,y1,x3,y3,x2,y2,x4,y4)	)
    	return 1;
    else
    	return 0;

}

////////
bool isEqualateralTriangle(int x1, int y1,int x2, int y2, int x3, int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);
	if(d1 == d2 && d1 == d3){
		return 1;
	}
	else
		return 0;

}

// checking if , first piont is right angle
bool isRightAngleTriangleHelper(int x1, int y1 ,int x2 , int y2 , int x3 , int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);

	if(d2 == (d1 + d3)){
		return 1;
	}
	return 0;

}

bool isRightAngleTriangle(int x1, int y1, int x2 ,int y2 ,int x3 , int y3){

	if(isRightAngleTriangleHelper(x1,y1,x2,y2,x3,y3) ||
		isRightAngleTriangleHelper(x2,y2,x3,y3,x1,y1) ||
		  isRightAngleTriangleHelper(x3,y3,x1,y1,x2,y2))
		return 1;

	return 0;

}

bool areCollinear(int x1, int y1,int x2 , int y2 , int x3 , int y3){
	return ( (x3-x1)*(y2-y1) == (y3-y1)*(x2-x1));
}

/*
vi g[maxn];
int n , par[maxn];
vi traceBack(int node) {
    vi ret;
    while(par[node] != node) {
        ret.PB(node);
        node = par[node];
    }
    ret.PB(node);
    return ret;
}

// even if the grpah is disconnected, this function will return the cycle.
// define an array "par" , take graph input in "g" , number of nodes are "n", and
// parent of the starting node will be the beginning of the bfs... it returns only one cycle, in O ( n ) ;
// nodes are supposed to be in 1-index
vi getCycle() {
    vi ans;
    repl(i,1,n) {
        if (par[i] == -1) {
            par[i] = i;
            queue<int> q;
            q.push(i);
            bool foundCycle = false;
            while(q.size()) {
                auto fr = q.front();
                q.pop();
                for ( auto nbr : g[fr]) {
                    if (nbr != par[fr]) {
                        if (par[nbr] == -1) {
                            par[nbr] = fr;
                            q.push(nbr);
                        } else {
                            vi v1 = traceBack(fr);
                            vi v2 = traceBack(nbr);
                            map < int , int > m;
                            for ( auto i : v1 ) {
                                m[i] = 1;
                            }
                            int meetingPoint;
                            for ( auto i : v2 ) {
                                if(m[i]) {
                                    meetingPoint = i;break;
                                }
                            }
                            vi v11 , v22;
                            for ( auto i : v1) {
                                v11.PB(i);
                                if(i == meetingPoint)break;
                            }
                            for ( auto i : v2) {
                                v22.PB(i);
                                if(i == meetingPoint)break;
                            }

                            reverse(v22.begin(),v22.end());
                            int sz2 = v22.size();
                            repl(i,1,sz2-1) {
                                v11.PB(v22[i]);
                            }
                            NL
                            return v11;
                            foundCycle = true; // we actually never reach here... we return // in case we need to have some other flow, we can do it...
                            break;
                        }
                    }
                }
                if(foundCycle) { // never in this condition
                    break;
                }
            }
        }
    }
    return ans;
}
*/

// eratoshenes sieve ...
// Once eratoshtenes is activated, use the isPrime function below it,
// and deactivate above function

int lp[maxn];
vector<int> pr;
void generatePrimes()
{
	for (int i=2; i<=maxn; ++i)
	{
		if (lp[i] == 0)
		{
			lp[i] = i;
			pr.push_back (i);
		}
		for (unsigned j=0; j<pr.size() && pr[j]<=lp[i] && i*pr[j]<maxn;)
		{
			lp[i * pr[j]] = pr[j];
			j++;
		}
	}
	return;
}

bool isPrime(int n)
{
	int root = sqrt(n);
	for(int i = 0 ; i < pr.size() && pr[i] <= root ; i++) if(n%pr[i] == 0) return 0;
	return 1;
}

/////////////////////////
// declaration section //
/////////////////////////

si s;
int n,x,tot,f[maxn];

void getInput() {
    cin >> n;
    // cin >> x;
    OFLUSH IFLUSH
    repl(i,1,n) s.I(i);
    tot = n;
}

int TypeB(int i) {
    tot++;
    int ret=0;
    cout << "B " << i ; NL
    OFLUSH
    cin >> ret;

    // rep(j,n) {
    //     if(j*i>n)break;
    //     if(s.find(j*i) != s.end()) {
    //         ret++;
    //     }
    //     if(x != j*i) {
    //         s.ER(j*i);
    //     }
    // }
    // cout << ret << endl;
    return ret;
}

int TypeA(int i) {
    tot++;
    int ret=0;
    cout << "A " << i ; NL
    OFLUSH
    cin >> ret;
    // rep(j,n) {
    //     if(j*i>n)break;
    //     if(s.find(j*i) != s.end()) {
    //         ret++;
    //     }
    // }
    // cout << ret << endl;
    return ret;
}

void solve() {
    vi ans;
    bool foundSmallest = false;

    for ( int k = 0 ; k < pr.size();) {
        int i = pr[k];
        if (i > n) break;
        int cnt = 0;
        int cnt2;
        int vall = i;
        repl(j,1,n+1) {
            if (!f[vall]) {
                cnt++;
                f[vall] = 1;
                tot--;
            }
            vall += i;
            if(vall > n)break;
        }
        cnt2 = TypeB(i);
        if(cnt != cnt2) {
            ans.PB(i);
        }
        k++;
        if (k % 100 == 99 || k == pr.size() || pr[k] > n ) {
            cnt2 = TypeA(1);
            cnt = tot;
            if(cnt2 != cnt) {
                int kk = max((int)k - (int)99,(int)0);
                while(1) {
                    cnt2 = TypeA(pr[kk]);
                    if(cnt2) {
                        ans.PB(pr[kk]);
                        break;
                    }
                    kk++;
                    if(kk == pr.size())break;
                }
                foundSmallest = true;
            }
        }
        if(pr[k] > n) break;
    }
    int finalAns = 1;
    int mul;
    int cnt2;
    for ( auto i : ans) {
        mul = i;
        while(1) {
            cnt2 = TypeA(mul*i);
            if(cnt2 == 0)break;
            mul = mul*i;
        }
        finalAns = mul * finalAns;
    }
    cout << "C " << finalAns << endl;
}
signed main() {

    generatePrimes();

    //freopen("in.txt" , "r" , stdin) ;
    //freopen("out.txt" , "w" , stdout) ;

    int t=1;
    // cin >> t;
    while(t--)
        getInput() , solve();

	return 0;
}


//~ mail ID : neernpatel@gmail.com
//~ Author : DrexDelta
//~ codechef : drexdelta , hackerRank : drexdelta , codeforces : drexdelta1
//~ Contact Info : neernpatel@gmail.com

#include <iostream>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>

using namespace std;

#define F first
#define S second
#define MP make_pair
#define PB push_back
#define UB upper_bound
#define LB lower_bound
#define ER erase
#define EN end()
#define B begin()
#define I insert
#define OPTIMIZE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int ll
#define endl "\n"
#define CO cout <<
#define CI cin >>
#define NL cout << endl;
#define DBG {int debug ; cin >> debug;}
#define AND &&
#define OR ||
#define XOR ^
#define OFLUSH fflush(stdout);
#define IFLUSH fflush(stdin);
#define LEN(x) ((int)x.length())

#define rep(i,x) for(int i = 0 ; i < x ; i++)
#define rep1(i,x) for(int i = 1 ; i <= x ; i++)

#define repl(var,start_val,limit_val) for(int var = start_val ; var <= limit_val ; var++)
#define perl(var,start_val,limit_val) for(int var = start_val ; var >= limit_val ; var--)

#define y1 qwert
#define y2 trewq
#define x1 asdfg
#define x2 gfdsa

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< ii > vii;
typedef set<int> si;
typedef multiset<int> msi;
typedef long double ld;

const ll maxn = 1e5+6 ;
const ll MOD = 1e9 + 7 ;

bool comparator(int i , int j)
{
    return (i < j);
}

struct setCompare {
    bool operator() (const int64_t& lhs, const int64_t& rhs) const {
        // return s1.str() < s2.str();
    }
};

ll power(ll x, ll i)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%MOD;
		i >>=1;
		x = (x*x)%MOD;
	}
	return ans;
}

ll power(ll x, ll i,ll mod)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%mod;
		i >>=1;
		x = (x*x)%mod;
	}
	return ans;
}

ll modInverse(ll x, ll mod)
{
	return power(x , mod-2,mod);
}

bool isPalindrome(string s)
{
	int limit = s.length()/2;
	for(int i =  0 ; i < limit ; i++)
		if(s[i] != s[s.length()-i-1])
			return false;
	return true;
}

ll gcd(ll x, ll y)
{
	ll t;
	while(y != 0)
		t = x%y,x = y,y = t;
	return x;
}

bool isVowel(char ch){

    if(ch == 'a' || ch == 'i' || ch == 'e' || ch == 'u' || ch == 'o' || ch == 'y'){
        return true;
    }
    return false;
}

//////////////
// Geometry //
//////////////

ld getDisSquare(ld x1 ,ld y1,ld x2,ld y2){
	return ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

/////////////
bool isSquareHelper(int x1 , int y1 , int x2 , int y2 , int x3 , int y3 , int x4 , int y4){

	ld d1,d2,d3,d4,d5,d6;
	d1 = getDisSquare(x1,y1,x2,y2);
	d2 = getDisSquare(x2,y2,x3,y3);
	d3 = getDisSquare(x3,y3,x4,y4);
	d4 = getDisSquare(x4,y4,x1,y1);

	if(d1 == d2 && d1 == d3 && d1 == d4){

		d5 = getDisSquare(x1,y1,x3,y3);
		d6 = getDisSquare(x2,y2,x4,y4);
		if(d5 == d6){
			return 1;
		}

	}

	return 0;

}

// pass 4 points in any order,
// returns 1 if it forms square, else returns zero

bool isSquare(int x1 ,int y1 , int x2 , int y2 , int x3 , int y3 ,int x4 , int y4){

    if(	isSquareHelper(x1,y1,x2,y2,x3,y3,x4,y4) ||
    	isSquareHelper(x1,y1,x2,y2,x4,y4,x3,y3) ||
    	isSquareHelper(x1,y1,x3,y3,x2,y2,x4,y4)	)
    	return 1;
    else
    	return 0;

}

////////
bool isEqualateralTriangle(int x1, int y1,int x2, int y2, int x3, int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);
	if(d1 == d2 && d1 == d3){
		return 1;
	}
	else
		return 0;

}

// checking if , first piont is right angle
bool isRightAngleTriangleHelper(int x1, int y1 ,int x2 , int y2 , int x3 , int y3){

	int d1 = getDisSquare(x1,y1,x2,y2);
	int d2 = getDisSquare(x2,y2,x3,y3);
	int d3 = getDisSquare(x3,y3,x1,y1);

	if(d2 == (d1 + d3)){
		return 1;
	}
	return 0;

}

bool isRightAngleTriangle(int x1, int y1, int x2 ,int y2 ,int x3 , int y3){

	if(isRightAngleTriangleHelper(x1,y1,x2,y2,x3,y3) ||
		isRightAngleTriangleHelper(x2,y2,x3,y3,x1,y1) ||
		  isRightAngleTriangleHelper(x3,y3,x1,y1,x2,y2))
		return 1;

	return 0;

}

bool areCollinear(int x1, int y1,int x2 , int y2 , int x3 , int y3){
	return ( (x3-x1)*(y2-y1) == (y3-y1)*(x2-x1));
}

/*
vi g[maxn];
int n , par[maxn];
vi traceBack(int node) {
    vi ret;
    while(par[node] != node) {
        ret.PB(node);
        node = par[node];
    }
    ret.PB(node);
    return ret;
}

// even if the grpah is disconnected, this function will return the cycle.
// define an array "par" , take graph input in "g" , number of nodes are "n", and
// parent of the starting node will be the beginning of the bfs... it returns only one cycle, in O ( n ) ;
// nodes are supposed to be in 1-index
vi getCycle() {
    vi ans;
    repl(i,1,n) {
        if (par[i] == -1) {
            par[i] = i;
            queue<int> q;
            q.push(i);
            bool foundCycle = false;
            while(q.size()) {
                auto fr = q.front();
                q.pop();
                for ( auto nbr : g[fr]) {
                    if (nbr != par[fr]) {
                        if (par[nbr] == -1) {
                            par[nbr] = fr;
                            q.push(nbr);
                        } else {
                            vi v1 = traceBack(fr);
                            vi v2 = traceBack(nbr);
                            map < int , int > m;
                            for ( auto i : v1 ) {
                                m[i] = 1;
                            }
                            int meetingPoint;
                            for ( auto i : v2 ) {
                                if(m[i]) {
                                    meetingPoint = i;break;
                                }
                            }
                            vi v11 , v22;
                            for ( auto i : v1) {
                                v11.PB(i);
                                if(i == meetingPoint)break;
                            }
                            for ( auto i : v2) {
                                v22.PB(i);
                                if(i == meetingPoint)break;
                            }

                            reverse(v22.begin(),v22.end());
                            int sz2 = v22.size();
                            repl(i,1,sz2-1) {
                                v11.PB(v22[i]);
                            }
                            NL
                            return v11;
                            foundCycle = true; // we actually never reach here... we return // in case we need to have some other flow, we can do it...
                            break;
                        }
                    }
                }
                if(foundCycle) { // never in this condition
                    break;
                }
            }
        }
    }
    return ans;
}
*/

// eratoshenes sieve ...
// Once eratoshtenes is activated, use the isPrime function below it,
// and deactivate above function

int lp[maxn];
vector<int> pr;
void generatePrimes()
{
	for (int i=2; i<=maxn; ++i)
	{
		if (lp[i] == 0)
		{
			lp[i] = i;
			pr.push_back (i);
		}
		for (unsigned j=0; j<pr.size() && pr[j]<=lp[i] && i*pr[j]<maxn;)
		{
			lp[i * pr[j]] = pr[j];
			j++;
		}
	}
	return;
}

bool isPrime(int n)
{
	int root = sqrt(n);
	for(int i = 0 ; i < pr.size() && pr[i] <= root ; i++) if(n%pr[i] == 0) return 0;
	return 1;
}

/////////////////////////
// declaration section //
/////////////////////////

si s;
int n;

void getInput() {
    cin >> n;
    OFLUSH IFLUSH
    repl(i,1,n) s.I(i);
}

void solve() {
    vi ans;
    bool foundSmallest = false;

    for ( int k = 0 ; k < pr.size() ; ) {

        int i = pr[k];
        if (i > n) break;
        int cnt = 0;
        int cnt2;
        repl(j,1,n+1) {
            auto it = s.find(j*i);
            if( it != s.end()) cnt++, s.ER(it);
            if(j*i > n)break;
        }
        cout << "B " << i ; NL
        OFLUSH IFLUSH
        cin >> cnt2;
        IFLUSH OFLUSH
        if(cnt != cnt2) {
            ans.PB(i);
        }
        k++;
        if (k == pr.size() || k % 100 == 99 || pr[k] > n) {
            cout << "A 1" << endl;
            OFLUSH IFLUSH
            cin >> cnt2;
            IFLUSH OFLUSH
            cnt = s.size();
            if(cnt2 != cnt) {
                int kk = max((int)k - (int)99,(int)0);
                while(1) {
                    cout << "A " << pr[kk] ; NL
                    OFLUSH IFLUSH
                    cin >> cnt2;
                    IFLUSH OFLUSH
                    if(cnt2) {
                        ans.PB(pr[kk]);
                        break;
                    }
                    kk++;
                }
                foundSmallest = true;
            }
            break;
        }
        if(pr[k] > n) break;
    }
    int finalAns = 1;
    int mul;
    int cnt2;
    for ( auto i : ans) {
        mul = i;
        while(1) {
            cout << "A " << mul*i ; NL
            OFLUSH IFLUSH
            cin >> cnt2;
            IFLUSH OFLUSH
            if(cnt2 == 0)break;
            mul = mul*i;
        }
        finalAns = mul * finalAns;
    }
    cout << "C " << finalAns << endl;
}
signed main() {

    OPTIMIZE
    generatePrimes();

    //freopen("in.txt" , "r" , stdin) ;
    //freopen("out.txt" , "w" , stdout) ;

    int t=1;
    // cin >> t;
    while(t--)
        getInput() , solve();

	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=1e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
void init(){
	for(int i=2;i<PRSIZE;++i){
		isprime[i]=true;
	}
	for(int i=2;i<PRSIZE;++i){
		if(isprime[i]){
			for(int j=2;j*i<PRSIZE;++j)
			isprime[j*i]=false;
			primelist.push_back(i);
		}
	}
	return ;
}
int main(){
	init();
//	cout<<primelist.size();
	int n=read();
	int allcnt=n;
	int querynumber=0;
	bool finder=false;
	vector<int>deletelist;
	for(int i=1;i<=maxquery;++i){
		if(querynumber<=primelist.size()&&primelist[i]<=n){
			//query prime;
			int thisnum=primelist[querynumber++];
			cout<<"B "<<thisnum<<'\n';
			fflush(stdout);
			//int willdeleted=0;
			for(int j=1;j*thisnum<=n;++j){
				if(isdeleted[j*thisnum]==false){
					isdeleted[j*thisnum]=true;
					deletelist.push_back(j*thisnum);
					//++willdeleted;
				}
			}
			int deletenumber=deletelist.size();
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
				while(!deletelist.empty()){
					int nowans=deletelist.back();
					cout<<"A "<<nowans<<'\n';
					int queryans=read();
					//now i konw i can prove that ...
					if(queryans==1){
						cout<<"C "<<nowans<<'\n';
						break;
					}
					deletelist.pop_back();
				}
				finder=true;
				break;
			}
			deletelist.clear();
		}
		else{
			break;
		}
	}
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
//	int cnt=0;
//	for(int i=2;i<=100000;++i){
//		int sq=sqrt(i);
//		bool checker=true;
//		for(int j=2;j<=sq;++j){
//			if(i%j==0){
//				checker=false;
//				break;
//			}
////			if(j==sq)cnt++;
//		}
//		if(checker){
//			//cout<<i<<' ';
//			++cnt;
//		}
//	}
//	cout<<cnt; //9592
/*
10
B 2
4
A 10
0
A 8
0
A 6
0
A 4
1
C 4
*/
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<cassert>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=2e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
vector<int>primeval[10000];
int n;
void init(){
	for(int i=2;i<=n;++i){
		isprime[i]=true;
	}
	for(int i=2;i<=n;++i){
		if(isprime[i]){
			int sz=primelist.size();
			primeval[sz].push_back(i);
			for(int j=2;j*i<PRSIZE;++j){
				if(isprime[j*i]!=false){
					isprime[j*i]=false;
					primeval[sz].push_back(j*i);
				}
			}
//			cout<<primeval[sz].size()<<' ';
			primelist.push_back(i);
		}
	}
	return ;
}
vector<int>block;
int main(){
	n=read();
	init();
	int allcnt=n;
	int querynum=0;
	bool finder=false;
	int i=1;
	for(i=1;i<maxquery;){
		if(querynum<primelist.size()&&primelist[querynum]<=n){
			int thisnum=primelist[querynum];
			{
			printf("B %d\n",thisnum),++i;
			if(i==maxquery)assert(1==0);
			fflush(stdout);
			}
			int deletenumber=read();
			allcnt-=deletenumber;
//			cout<<"A "<<thisnum<<'\n';
//			fflush(stdout);
//			int nowdeletednumber=read();
			//int willdeleted=0;
			//int deletenumber=deletelist.size();
//			if(deletenumber!=nowdeletednumber){
				int l=0,r=primeval[querynum].size()-1;
				int answer=0;
				while(l<=r){
					int mid=(l+r)/2;
					int nowans=primeval[querynum][mid];
					{
					printf("A %d\n",nowans),++i;
					if(i==maxquery)assert(1==0);
					fflush(stdout);
					}
					int queryans=read();
					if(queryans==0){
						r=mid-1;
						continue;
					}
					else if(queryans==1){
						l=mid+1;
						answer=max(answer,nowans);
					}
					else{
						while(1);
					}
				}
				if(answer!=0){
					{
						printf("C %d\n",answer),++i;
						if(i==maxquery)assert(1==0);
						fflush(stdout);
					}

					finder=true;
					break;
				}
//			}
			querynum++;
		}
		else if(querynum<primelist.size()&&primelist[querynum]>n){
			break;
			//choose 20 as block size
			int thisnum=primelist[querynum];
			{
				printf("B %d\n",thisnum),++i;
				if(i==maxquery)assert(1==0);
				fflush(stdout);
			}

			int deletenumber=read();
			allcnt-=1;
			block.push_back(thisnum);
			if(block.size()==20||querynum==primelist.size()-1){
				{
					printf("A 1\n"),++i;
					if(i==maxquery)assert(1==0);
					fflush(stdout);
				}

				int queryans=read();
				if(queryans>allcnt){
					bool checker=false;
					for(int iprime=0;iprime<block.size();++iprime){
						{
							printf("B %d\n",block[iprime]),++i;
							if(i==maxquery)assert(1==0);
							fflush(stdout);
						}
						int getnumber=read();
						if(getnumber==1){

							{
								printf("C %d\n",block[iprime]),++i;
								if(i==maxquery)assert(1==0);
								fflush(stdout);
							}
							finder=true;
							break;
						}
					}
					if(checker){
						finder=true;
						break;
					}
				}
				block.clear();
			}
			querynum++;
		}
		else break;
	}
	if(i>=maxquery-1)assert(1==0);
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=1e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
vector<int>primeval[9593];
int n;
void init(){
	for(int i=2;i<=n;++i){
		isprime[i]=true;
	}
	for(int i=2;i<=n;++i){
		if(isprime[i]){
			int sz=primelist.size();
			primeval[sz].push_back(i);
			for(int j=2;j*i<PRSIZE;++j){
				if(isprime[j*i]!=false){
					isprime[j*i]=false;
					primeval[sz].push_back(j*i);
				}
			}
//			cout<<primeval[sz].size()<<' ';
			primelist.push_back(i);
		}
	}
	return ;
}
int main(){
	n=read();
	init();
	int allcnt=n;
	int querynumber=0;
	bool finder=false;
	for(int i=1;i<=maxquery;++i){
		if(querynumber<primelist.size()&&primelist[querynumber]<=n){
			int thisnum=primelist[querynumber++];
			printf("B %d\n",thisnum);
			fflush(stdout);
			int deletenumber=read();
			printf("A %d\n",thisnum);
			fflush(stdout);
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
			//	int start=n/thisnum;
				int l=0,r=primeval[querynumber-1].size()-1;
				int nowans=0;
				while(l<=r){
					unsigned int mid=(l+r)/2;
					int nowans=primeval[querynumber-1][mid];
					if(isdeleted[nowans])continue;
					else isdeleted[nowans]=true;
					printf("A %d\n",nowans);
					fflush(stdout);
					int queryans=read();
					if(queryans>1){
						l=mid+1;
						continue;
					}
					else if(queryans<1){
						r=mid-1;
						continue;
					}
					else if(queryans==1){
						l=mid+1;
						nowans=max(nowans,mid);
					}

				}
				if(nowans!=0){
					printf("C %d\n",nowans);
					fflush(stdout);
					break;
				}
				finder=true;
				break;
			}
		}
		else{
			break;
		}
	}
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<cassert>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=2e5;
int isprime[PRSIZE];
vector<int>primelist;
vector<int>primeval[10000];
int n;
void init(){
	for(int i=2;i<=n;++i){
		isprime[i]=true;
	}
	for(int i=2;i<=n;++i){
		if(isprime[i]){
			int sz=primelist.size();
			primeval[sz].push_back(i);
			for(int j=2;j*i<PRSIZE;++j){
				if(isprime[j*i]!=false){
					isprime[j*i]=false;
					primeval[sz].push_back(j*i);
				}
			}
//			cout<<primeval[sz].size()<<' ';
			primelist.push_back(i);
		}
	}
	return ;
}
vector<int>block;//to solve primelist[query]>n
int main(){
	n=read();
	init();
	int allcnt=n;
	unsigned int querynum=0;
	bool finder=false;
	int i=1;
	for(i=1;i<maxquery;){
		if(querynum<primelist.size()&&primelist[querynum]<=sqrt(n)){
			int thisnum=primelist[querynum];
			{
			printf("B %d\n",thisnum),++i;
			//if(i==maxquery)assert(1==0);
			fflush(stdout);
			}
			int deletenumber=read();
			allcnt-=deletenumber;
			cout<<"A "<<thisnum<<'\n';
			fflush(stdout);
			int nowdeletednumber=read();
			if(nowdeletednumber!=0){
				int number=thisnum;
				int answer=thisnum;
				while(1){
					int rp=false;
					for(unsigned int ip=0;ip<primelist.size()&&primelist[ip]*number<=n;++ip){
						printf("B %d\n",primelist[ip]*number),++i;
						//if(i==maxquery)assert(1==0);
						fflush(stdout);
						int response=read();
						if(response==1){
							number=primelist[ip]*number;
							answer=max(answer,number);
							rp=true;
							break;
						}
						if(response==0){
							rp=false;
						}
					}
					if(rp==false)break;
				}
				if(answer!=0){
					{
						printf("C %d\n",answer),++i;
				//		if(i==maxquery)assert(1==0);
						fflush(stdout);
					}

					finder=true;
					break;
				}
			}
			querynum++;
		}
		else if(querynum<primelist.size()&&primelist[querynum]<=n){
			//break;
			//choose 20 as block size
			int thisnum=primelist[querynum];
			{
				printf("B %d\n",thisnum),++i;
				if(i==maxquery)assert(1==0);
				fflush(stdout);
			}

			int deletenumber=read();
			allcnt-=1;
			block.push_back(thisnum);
			if(block.size()==500||querynum==primelist.size()-1){
				{
					printf("A 1\n"),++i;
					if(i==maxquery)assert(1==0);
					fflush(stdout);
				}

				int queryans=read();
				if(queryans>allcnt){
					bool checker=false;
					for(unsigned int iprime=0;iprime<block.size();++iprime){
						{
							printf("B %d\n",block[iprime]),++i;
							if(i==maxquery)assert(1==0);
							fflush(stdout);
						}
						int getnumber=read();
						if(getnumber==1){

							{
								printf("C %d\n",block[iprime]),++i;
								if(i==maxquery)assert(1==0);
								fflush(stdout);
							}
							finder=true;
							break;
						}
					}
					if(checker){
						finder=true;
						break;
					}
				}
				block.clear();
			}
			querynum++;
		}
		else break;
	}
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<cassert>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=2e5;
int isprime[PRSIZE];
vector<int>primelist;
vector<int>primeval[10000];
int n;
void init(){
	for(int i=2;i<=n;++i){
		isprime[i]=true;
	}
	for(int i=2;i<=n;++i){
		if(isprime[i]){
			int sz=primelist.size();
			primeval[sz].push_back(i);
			for(int j=2;j*i<PRSIZE;++j){
				if(isprime[j*i]!=false){
					isprime[j*i]=false;
					primeval[sz].push_back(j*i);
				}
			}
//			cout<<primeval[sz].size()<<' ';
			primelist.push_back(i);
		}
	}
	return ;
}
vector<int>block;//to solve primelist[query]>n
int main(){
	n=read();
	init();
	int allcnt=n;
	unsigned int querynum=0;
	bool finder=false;
	int i=1;
	for(i=1;i<maxquery;){
		if(querynum<primelist.size()&&primelist[querynum]<=n){
			int thisnum=primelist[querynum];
			{
			printf("B %d\n",thisnum),++i;
			//if(i==maxquery)assert(1==0);
			fflush(stdout);
			}
			int deletenumber=read();
			allcnt-=deletenumber;
			cout<<"A "<<thisnum<<'\n';
			fflush(stdout);
			int nowdeletednumber=read();
			if(nowdeletednumber!=0){
				int number=thisnum;
				int answer=thisnum;
				while(1){
					int rp=false;
					for(unsigned int ip=0;ip<primelist.size()&&primelist[ip]*number<=n;++ip){
						printf("B %d\n",primelist[ip]*number),++i;
						//if(i==maxquery)assert(1==0);
						fflush(stdout);
						int response=read();
						if(response==1){
							number=primelist[ip]*number;
							answer=max(answer,number);
							rp=true;
							break;
						}
						if(response==0){
							rp=false;
						}
					}
					if(rp==false)break;
				}
				if(answer!=0){
					{
						printf("C %d\n",answer),++i;
				//		if(i==maxquery)assert(1==0);
						fflush(stdout);
					}

					finder=true;
					break;
				}
			}
			querynum++;
		}
		else if(querynum<primelist.size()&&primelist[querynum]>n){
			break;
			//choose 20 as block size
			int thisnum=primelist[querynum];
			{
				printf("B %d\n",thisnum),++i;
				if(i==maxquery)assert(1==0);
				fflush(stdout);
			}

			int deletenumber=read();
			allcnt-=1;
			block.push_back(thisnum);
			if(block.size()==20||querynum==primelist.size()-1){
				{
					printf("A 1\n"),++i;
					if(i==maxquery)assert(1==0);
					fflush(stdout);
				}

				int queryans=read();
				if(queryans>allcnt){
					bool checker=false;
					for(unsigned int iprime=0;iprime<block.size();++iprime){
						{
							printf("B %d\n",block[iprime]),++i;
							if(i==maxquery)assert(1==0);
							fflush(stdout);
						}
						int getnumber=read();
						if(getnumber==1){

							{
								printf("C %d\n",block[iprime]),++i;
								if(i==maxquery)assert(1==0);
								fflush(stdout);
							}
							finder=true;
							break;
						}
					}
					if(checker){
						finder=true;
						break;
					}
				}
				block.clear();
			}
			querynum++;
		}
		else break;
	}
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<cassert>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=2e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
vector<int>primeval[10000];
int n;
void init(){
	for(int i=2;i<=n;++i){
		isprime[i]=true;
	}
	for(int i=2;i<=n;++i){
		if(isprime[i]){
			int sz=primelist.size();
			primeval[sz].push_back(i);
			for(int j=2;j*i<PRSIZE;++j){
				if(isprime[j*i]!=false){
					isprime[j*i]=false;
					primeval[sz].push_back(j*i);
				}
			}
//			cout<<primeval[sz].size()<<' ';
			primelist.push_back(i);
		}
	}
	return ;
}
vector<int>block;//to solve primelist[query]>n
int main(){
	n=read();
	init();
	int allcnt=n;
	unsigned int querynum=0;
	bool finder=false;
	int i=1;
	for(i=1;i<maxquery;){
		if(querynum<100&&primelist[querynum]<=n){
			int thisnum=primelist[querynum];
			{
			printf("B %d\n",thisnum),++i;
			//if(i==maxquery)assert(1==0);
			fflush(stdout);
			}
			int deletenumber=read();
			allcnt-=deletenumber;
			cout<<"A "<<thisnum<<'\n';
			fflush(stdout);
			int nowdeletednumber=read();
			if(nowdeletednumber!=0){
				int number=thisnum;
				int answer=thisnum;
				while(1){
					int rp=false;
					for(unsigned int ip=0;ip<primelist.size()&&primelist[ip]*number<=n;++ip){
						printf("B %d\n",primelist[ip]*number),++i;
						//if(i==maxquery)assert(1==0);
						fflush(stdout);
						int response=read();
						if(response==1){
							number=primelist[ip]*number;
							answer=max(answer,number);
							rp=true;
							break;
						}
						if(response==0){
							rp=false;
						}
					}
					if(rp==false)break;
				}
				if(answer!=0){
					{
						printf("C %d\n",answer),++i;
				//		if(i==maxquery)assert(1==0);
						fflush(stdout);
					}

					finder=true;
					break;
				}
			}
			querynum++;
		}
		else if(querynum<primelist.size()&&primelist[querynum]>n){
		//	break;
			//choose 20 as block size
			int thisnum=primelist[querynum];
			{
				printf("B %d\n",thisnum),++i;
				if(i==maxquery)assert(1==0);
				fflush(stdout);
			}

			int deletenumber=read();
			allcnt-=1;
			block.push_back(thisnum);
			if(block.size()==20||querynum==primelist.size()-1){
				{
					printf("A 1\n"),++i;
					if(i==maxquery)assert(1==0);
					fflush(stdout);
				}

				int queryans=read();
				if(queryans>allcnt){
					bool checker=false;
					for(unsigned int iprime=0;iprime<block.size();++iprime){
						{
							printf("B %d\n",block[iprime]),++i;
							if(i==maxquery)assert(1==0);
							fflush(stdout);
						}
						int getnumber=read();
						if(getnumber==1){

							{
								printf("C %d\n",block[iprime]),++i;
								if(i==maxquery)assert(1==0);
								fflush(stdout);
							}
							finder=true;
							break;
						}
					}
					if(checker){
						finder=true;
						break;
					}
				}
				block.clear();
			}
			querynum++;
		}
		else break;
	}
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=1e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
vector<int>primeval[9593];
void init(){
	for(int i=2;i<PRSIZE;++i){
		isprime[i]=true;
	}
	for(int i=2;i<PRSIZE;++i){
		if(isprime[i]){
			int sz=primelist.size();
			primeval[sz].push_back(i);
			for(int j=2;j*i<PRSIZE;++j){
				if(isprime[j*i]!=false){
					isprime[j*i]=false;
					primeval[sz].push_back(j*i);
				}
			}
			primelist.push_back(i);
		}
	}
	return ;
}
int main(){
	init();
	int n=read();
	int allcnt=n;
	int querynumber=0;
	bool finder=false;
	for(int i=1;i<=100;++i){
		if(querynumber<primelist.size()&&primelist[querynumber]<=n){
			int thisnum=primelist[querynumber++];
			printf("B %d\n",thisnum);
			fflush(stdout);
			int deletenumber=read();
			printf("A %d\n",thisnum);
			fflush(stdout);
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
			//	int start=n/thisnum;
				for(int j=primeval[querynumber-1].size()-1;j>=0;--j){
					int nowans=primeval[querynumber-1][j];
					if(isdeleted[nowans])continue;
					else isdeleted[nowans]=true;
					printf("A %d\n",nowans);
					fflush(stdout);
					int queryans=read();
					if(queryans==1){
						printf("C %d\n",nowans);
						fflush(stdout);
						break;
					}

				}
				finder=true;
				break;
			}
		}
		else{
			break;
		}
	}
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<cassert>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=2e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
vector<int>primeval[10000];
int n;
void init(){
	for(int i=2;i<=n;++i){
		isprime[i]=true;
	}
	for(int i=2;i<=n;++i){
		if(isprime[i]){
			int sz=primelist.size();
			primeval[sz].push_back(i);
			for(int j=2;j*i<PRSIZE;++j){
				if(isprime[j*i]!=false){
					isprime[j*i]=false;
					primeval[sz].push_back(j*i);
				}
			}
			cout<<primeval[sz].size()<<' ';
			primelist.push_back(i);
		}
	}
	return ;
}
vector<int>block;
int main(){
	n=read();
	init();
	int allcnt=n;
	int querynum=0;
	bool finder=false;
	int i=1;
	for(i=1;i<maxquery;){
		if(querynum<primelist.size()&&primeval[querynum].size()>1){
			int thisnum=primelist[querynum];
			{
			printf("B %d\n",thisnum),++i;
			if(i==maxquery)assert(1==0);
			fflush(stdout);
			}
			int deletenumber=read();
			allcnt-=deletenumber;
			cout<<"A "<<thisnum<<'\n';
			fflush(stdout);
			//int willdeleted=0;
			//int deletenumber=deletelist.size();
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
				int l=0,r=primeval[querynum].size()-1;
				int answer=0;
				while(l<=r){
					int mid=(l+r)/2;
					int nowans=primeval[querynum][mid];
					{
					printf("A %d\n",nowans),++i;
					if(i==maxquery)assert(1==0);
					fflush(stdout);
					}
					int queryans=read();
					if(queryans==0){
						r=mid-1;
						continue;
					}
					else if(queryans==1){
						l=mid+1;
						answer=max(answer,nowans);
					}
					else{
						while(1);
					}
				}
				if(answer!=0){
					{
						printf("C %d\n",answer),++i;
						if(i==maxquery)assert(1==0);
						fflush(stdout);
					}

					finder=true;
					break;
				}
			}
			querynum++;
		}
		else if(querynum<primelist.size()&&primelist[querynum]==1){
			assert(1==0);
			//choose 20 as block size
			int thisnum=primelist[querynum];
			{
				printf("B %d\n",thisnum),++i;
				if(i==maxquery)assert(1==0);
				fflush(stdout);
			}

			int deletenumber=read();
			allcnt-=1;
			block.push_back(thisnum);
			if(block.size()==20||querynum==primelist.size()-1){
				{
					printf("A 1\n"),++i;
					if(i==maxquery)assert(1==0);
					fflush(stdout);
				}

				int queryans=read();
				if(queryans>allcnt){
					bool checker=false;
					for(int iprime=0;iprime<block.size();++iprime){
						{
							printf("B %d\n",block[iprime]),++i;
							if(i==maxquery)assert(1==0);
							fflush(stdout);
						}
						int getnumber=read();
						if(getnumber==1){

							{
								printf("C %d\n",block[iprime]),++i;
								if(i==maxquery)assert(1==0);
								fflush(stdout);
							}
							finder=true;
							break;
						}
					}
					if(checker){
						finder=true;
						break;
					}
				}
				block.clear();
			}
			querynum++;
		}
		else{
			break;
		}
	}
	if(i>=maxquery-1)assert(1==0);
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e2;
const int PRSIZE=1e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
void init(){
	for(int i=2;i<PRSIZE;++i){
		isprime[i]=true;
	}
	for(int i=2;i<PRSIZE;++i){
		if(isprime[i]){
			for(int j=2;j*i<PRSIZE;++j)
			isprime[j*i]=false;
			primelist.push_back(i);
		}
	}
	return ;
}
int main(){
	init();
	int n=read();
	int allcnt=n;
	int querynumber=0;
	bool finder=false;
	for(int i=1;i<=maxquery;++i){
		if(querynumber<primelist.size()&&primelist[querynumber]<=n){
			int thisnum=primelist[querynumber++];
			printf("B %d \n",thisnum);
			fflush(stdout);
			int deletenumber=read();
			printf("A %d \n",thisnum);
			fflush(stdout);
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
				int start=n/thisnum;
				for(int j=start;j>=1;--j){
					int nowans=j*thisnum;
					if(isdeleted[nowans])continue;
					else isdeleted[nowans]=true;
					printf("A %d \n",nowans);
					fflush(stdout);
					int queryans=read();
					if(queryans==1){
						printf("C %d \n",nowans);
						fflush(stdout);
						break;
					}

				}
				finder=true;
				break;
			}
		}
		else{
			break;
		}
	}
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=1e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
vector<int>primeval[9593];
int n;
void init(){
	for(int i=2;i<=n;++i){
		isprime[i]=true;
	}
	for(int i=2;i<=n;++i){
		if(isprime[i]){
			int sz=primelist.size();
			primeval[sz].push_back(i);
			for(int j=2;j*i<PRSIZE;++j){
				if(isprime[j*i]!=false){
					isprime[j*i]=false;
					primeval[sz].push_back(j*i);
				}
			}
//			cout<<primeval[sz].size()<<' ';
			primelist.push_back(i);
		}
	}
	return ;
}
int main(){
	n=read();
	init();
	int allcnt=n;
	int querynumber=0;
	bool finder=false;
	for(int i=1;i<=maxquery;++i){
		if(querynumber<primelist.size()&&primelist[querynumber]<=n){
			int thisnum=primelist[querynumber++];
			printf("B %d\n",thisnum);
			fflush(stdout);
			int deletenumber=read();
			printf("A %d\n",thisnum);
			fflush(stdout);
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
			//	int start=n/thisnum;
				int l=0,r=primeval[querynumber-1].size()-1;
				while(l<=r)
					int mid=(l+r)/2;
					int nowans=primeval[querynumber-1][mid];
					if(isdeleted[nowans])continue;
					else isdeleted[nowans]=true;
					printf("A %d\n",nowans);
					fflush(stdout);
					int queryans=read();
					if(queryans>1){
						r=mid-1;
					}
					else if(queryans<1){
						l=mid+1;
					}
					if(queryans==1){
						printf("C %d\n",nowans);
						fflush(stdout);
						break;
					}

				}
				finder=true;
				break;
			}
		}
		else{
			break;
		}
	}
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=1e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
vector<int>primeval[9593];
int n;
void init(){
	for(int i=2;i<=n;++i){
		isprime[i]=true;
	}
	for(int i=2;i<=n;++i){
		if(isprime[i]){
			int sz=primelist.size();
			primeval[sz].push_back(i);
			for(int j=2;j*i<PRSIZE;++j){
				if(isprime[j*i]!=false){
					isprime[j*i]=false;
					primeval[sz].push_back(j*i);
				}
			}
//			cout<<primeval[sz].size()<<' ';
			primelist.push_back(i);
		}
	}
	return ;
}
int main(){
	n=read();
	init();
	int allcnt=n;
	int querynumber=0;
	bool finder=false;
	for(int i=1;i<=maxquery;++i){
		if(querynumber<primelist.size()&&primelist[querynumber]<=n){
			int thisnum=primelist[querynumber++];
			printf("B %d\n",thisnum);
			fflush(stdout);
			int deletenumber=read();
			printf("A %d\n",thisnum);
			fflush(stdout);
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
			//	int start=n/thisnum;
				int l=0,r=primeval[querynumber-1].size()-1;
				while(l<=r){
					unsigned int mid=(l+r)/2;
					int nowans=primeval[querynumber-1][mid];
					if(isdeleted[nowans])continue;
					else isdeleted[nowans]=true;
					printf("A %d\n",nowans);
					fflush(stdout);
					int queryans=read();
					if(queryans>1){
						r=mid-1;
						continue;
					}
					else if(queryans<1){
						l=mid+1;
						continue;
					}

					if(queryans==1){
						printf("C %d\n",nowans);
						fflush(stdout);
						break;
					}

				}
				finder=true;
				break;
			}
		}
		else{
			break;
		}
	}
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll 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;
}
const int maxquery=1e4;
const int PRSIZE=1e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
vector<int>primeval[9593];
int n;
void init(){
	for(int i=2;i<=n;++i){
		isprime[i]=true;
	}
	for(int i=2;i<=n;++i){
		if(isprime[i]){
			int sz=primelist.size();
			primeval[sz].push_back(i);
			for(int j=2;j*i<PRSIZE;++j){
				if(isprime[j*i]!=false){
					isprime[j*i]=false;
					primeval[sz].push_back(j*i);
				}
			}
//			cout<<primeval[sz].size()<<' ';
			primelist.push_back(i);
		}
	}
	return ;
}
int main(){
	n=read();
	init();
	int allcnt=n;
	int querynumber=0;
	bool finder=false;
	for(int i=1;i<=maxquery;++i){
		if(querynumber<primelist.size()&&primelist[querynumber]<=n){
			int thisnum=primelist[querynumber++];
			printf("B %d\n",thisnum);
			fflush(stdout);
			int deletenumber=read();
			printf("A %d\n",thisnum);
			fflush(stdout);
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
			//	int start=n/thisnum;
				int l=0,r=primeval[querynumber-1].size()-1;
				int nowans=0;
				while(l<=r){
					int mid=(l+r)/2;
					int nowans=primeval[querynumber-1][mid];
					if(isdeleted[nowans])continue;
					else isdeleted[nowans]=true;
					printf("A %d\n",nowans);
					fflush(stdout);
					int queryans=read();
					if(queryans>1){
						l=mid+1;
						continue;
					}
					else if(queryans<1){
						r=mid-1;
						continue;
					}
					else if(queryans==1){
						l=mid+1;
						nowans=max(nowans,mid);
					}

				}
				if(nowans!=0){
					printf("C %d\n",nowans);
					fflush(stdout);
					break;
				}
				finder=true;
				break;
			}
		}
		else{
			break;
		}
	}
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}