#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()==200||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;
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<=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=min(start,10000);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<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();
			deletenumber=deletelist.size();
			allcnt-=deletenumber;
			cout<<"A "<<thisnum<<'\n';
			fflush(stdout);
			int nowdeletednumber=read();
			int willdeleted=0;
			if(nowdeletednumber!=0){
				int number=thisnum;
				int answer=thisnum;
				while(1){
					int rp=false;
					for(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(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;
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(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;
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 deletenumber=read();
			cout<<"A "<<thisnum<<'\n';
			fflush(stdout);
			//int willdeleted=0;
			//int deletenumber=deletelist.size();
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
				int start=n/thisnum;
				for(int j=start;j>=1;--j){
					int nowans=j*thisnum;
					cout<<"A "<<nowans<<'\n';
					fflush(stdout);
					int queryans=read();
					//now i konw i can prove that ...
					if(queryans==1){
						cout<<"C "<<nowans<<'\n';
						fflush(stdout);
						break;
					}

				}
				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<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;
}
constexpr int SIZE=1e5+1;
constexpr int PRSIZE=1e4;//cnt=9592
int primelist[PRSIZE],pcnt=0;
bool isprime[SIZE];
int n;
//vector<int>primeval[PRSIZE];
void init(){
	for(int i=2;i<=n;++i) isprime[i]=true;
	for(int i=2;i<=n;++i){
		if(isprime[i]==true){
			primelist[pcnt++]=i;
			for(int j=2;j*i<=n;++j)
			isprime[i*j]=false;
		}
	}
}
inline int fpow(int a,int b){
	if(b==0) return 1;
	if(a==0) return 0;
	int ans=1,base=a;
	for(;b>0;b/=2){
		if(b&1)ans*=base;
		base=base*base;
	}
	return ans;
}
constexpr int BLOCKSIZE=98;//sqrt(9592)
int block[BLOCKSIZE],bcnt;
int main(){
	n=read();
	int sq=sqrt(double(n));
	init();
	int ans=1;
	int LLCNT=n;
	for(int i=0;i<pcnt;++i){
		int now=primelist[i];
		if(primelist[i]<=sq){
			cout<<"B "<<now<<endl;
			int answerB;
			cin>>answerB;//!=0
			LLCNT-=answerB;
			cout<<"A "<<now<<endl;
			int answerA;
			cin>>answerA;
			int factor=1;
			if(answerA!=0){
				int base=now;
				factor=base;
				for(int j=2;base*now<=n;++j){
					base*=now;
					cout<<"A "<<base<<endl;
					cin>>answerA;
					if(answerA==1)
					factor=base;
					else break;
				}
				ans*=factor;
			}
		}
		else if(ans==1){
			cout<<"B "<<now<<endl;
			block[bcnt++]=now;
			int answerB;
			cin>>answerB;
			LLCNT-=answerB;
			if(bcnt==BLOCKSIZE||i==pcnt-1){
				cout<<"A "<<1<<endl;
				int realcnt;
				cin>>realcnt;
				if(realcnt>LLCNT){
					for(int ib=0;ib<bcnt;++ib){
						cout<<"A "<<block[ib]<<endl;
						int answerA;
						cin>>answerA;
						if(answerA==1){
							ib=0;
							ans=block[ib];
							break;
						}
					}
				}
				bcnt=0;
			}
		}
		else break;
	}
	cout<<"C "<<ans<<endl;
	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[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;
	for(int i=1;i<maxquery;){
		if(querynum<primelist.size()&&primelist[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;
			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){
			//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>anscnt){
					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(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 answer=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;
						answer=max(answer,nowans);
					}

				}
				printf("C %d\n",answer);
				fflush(stdout);
				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;//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;
}
constexpr int SIZE=1e5+1;
constexpr int PRSIZE=1e4;//cnt=9592
int primelist[PRSIZE],pcnt=0;
bool isprime[SIZE];
int n;
//vector<int>primeval[PRSIZE];
void init(){
	for(int i=2;i<=n;++i) isprime[i]=true;
	for(int i=2;i<=n;++i){
		if(isprime[i]==true){
			primelist[pcnt++]=i;
			for(int j=2;j*i<=n;++j)
			isprime[i*j]=false;
		}
	}
}
inline int fpow(int a,int b){
	if(b==0) return 1;
	if(a==0) return 0;
	int ans=1,base=a;
	for(;b>0;b/=2){
		if(b&1)ans*=base;
		base=base*base;
	}
	return ans;
}
constexpr int BLOCKSIZE=98;//sqrt(9592)
int block[BLOCKSIZE],bcnt;
int main(){
	n=read();
	int sq=sqrt(double(n));
	init();
	int ans=1;
	int LLCNT=n;
	for(int i=0;i<pcnt;++i){
		int now=primelist[i];
		int answerA,answerB;
		if(primelist[i]<=sq){
			cout<<"B "<<now<<endl;
			cin>>answerB;//!=0
			LLCNT-=answerB;
			cout<<"A "<<now<<endl;
			cin>>answerA;
			int factor=1;
			if(answerA!=0){
				int base=now;
				factor=base;
				for(int j=2;base*now<=n;++j){
					base*=now;
					cout<<"A "<<base<<endl;
					cin>>answerA;
					if(answerA==1)
					factor=base;
					else break;
				}
				ans*=factor;
			}
		}
		else if(primelist[i]<=n){
			cout<<"B "<<now<<endl;
			block[bcnt++]=now;
			cin>>answerB;
			LLCNT-=answerB;
			if(bcnt==BLOCKSIZE||i==pcnt-1){
				cout<<"A "<<1<<endl;
				int realcnt;
				cin>>realcnt;
				if(realcnt>LLCNT){
					for(int ib=0;ib<bcnt;++ib){
						cout<<"A "<<block[ib]<<endl;
						cin>>answerA;
						if(answerA==1){
							ans*=block[ib];
							bcnt=0;
							break;
						}
					}
				}
				bcnt=0;
			}
		}
		else break;
	}
	cout<<"C "<<ans<<endl;
	return 0;
}


#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);
				}
			}
			primelist.push_back(i);
		}
	}
	return ;
}
int main(){
	n=read();
	init();
	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<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();
	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<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 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]>n){
			//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;
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<=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=min(start,100);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<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<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){
			//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;
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++];
			printf("B %d \n",thisnum);
		//	cout<<"B "<<thisnum<<'\n';
			fflush(stdout);
			int deletenumber=read();
			printf("A %d \n",thisnum);
		//	cout<<"A "<<thisnum<<'\n';
			fflush(stdout);
			//int willdeleted=0;
			//int deletenumber=deletelist.size();
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
				int start=n/thisnum;
				for(int j=start;j>=1;--j){
					int nowans=j*thisnum;
			printf("A %d \n",nowans);
		//			cout<<"A "<<nowans<<'\n';
					fflush(stdout);
					int queryans=read();
					//now i konw i can prove that ...
					if(queryans==1){
			printf("C %d \n",nowans);
		//				cout<<"C "<<nowans<<'\n';
						fflush(stdout);
						break;
					}

				}
				finder=true;
				break;
			}
		//	deletelist.clear();
		}
		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=1e5;
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;
	for(int 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;
			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){
			//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(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;
}
constexpr int SIZE=1e5+1;
constexpr int PRSIZE=1e4;//cnt=9592
int primelist[PRSIZE],pcnt=0;
bool isprime[SIZE];
int n;
//vector<int>primeval[PRSIZE];
void init(){
	for(int i=2;i<=n;++i) isprime[i]=true;
	for(int i=2;i<=n;++i){
		if(isprime[i]==true){
			primelist[pcnt++]=i;
			for(int j=2;j*i<=n;++j)
			isprime[i*j]=false;
		}
	}
}
inline int fpow(int a,int b){
	if(b==0) return 1;
	if(a==0) return 0;
	int ans=1,base=a;
	for(;b>0;b/=2){
		if(b&1)ans*=base;
		base=base*base;
	}
	return ans;
}
constexpr int BLOCKSIZE=98;//sqrt(9592)
int block[BLOCKSIZE],bcnt;
int main(){
	n=read();
	int sq=sqrt(double(n));
	init();
	int ans=1;
	int LLCNT=n;
	for(int i=0;i<pcnt;++i){
		int now=primelist[i];
		int answerA,answerB;
		if(primelist[i]<=sq){
			cout<<"B "<<now<<endl;
			cin>>answerB;//!=0
			LLCNT-=answerB;
			cout<<"A "<<now<<endl;
			cin>>answerA;
			int factor=1;
			if(answerA!=0){
				LLCNT+=answerA;
				int base=now;
				factor=base;
				for(int j=2;base*now<=n;++j){
					base*=now;
					cout<<"A "<<base<<endl;
					cin>>answerA;
					if(answerA==1)
					factor=base;
					else break;
				}
				ans*=factor;
			}
		}
		else if(ans<=sqrt(n)){
			cout<<"B "<<now<<endl;
			block[bcnt++]=now;
			cin>>answerB;
			LLCNT-=answerB;
			if(bcnt==BLOCKSIZE||i==pcnt-1){
				cout<<"A "<<1<<endl;
				int realcnt;
				cin>>realcnt;
				if(realcnt>LLCNT){
					for(int ib=0;ib<bcnt;++ib){
						cout<<"A "<<block[ib]<<endl;
						cin>>answerA;
						if(answerA==1){
							ans*=block[ib];
							bcnt=0;
							break;
						}
					}
				}
				bcnt=0;
			}
		}
		else break;
	}
	cout<<"C "<<ans<<endl;
	return 0;
}


#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);
//			cout<<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()==100||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;
					}
					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;
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();
//			deletenumber=deletelist.size();
			allcnt-=deletenumber;
			cout<<"A "<<thisnum<<'\n';
			fflush(stdout);
			int nowdeletednumber=read();
			int willdeleted=0;
			if(nowdeletednumber!=0){
				int number=thisnum;
				int answer=thisnum;
				while(1){
					int rp=false;
					for(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(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;
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<=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=min(start,1000);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<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()==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;
}
constexpr int SIZE=1e5+1;
constexpr int PRSIZE=1e4;//cnt=9592
int primelist[PRSIZE],pcnt=0;
bool isprime[SIZE];
int n;
//vector<int>primeval[PRSIZE];
void init(){
	for(int i=2;i<=n;++i) isprime[i]=true;
	for(int i=2;i<=n;++i){
		if(isprime[i]==true){
			primelist[pcnt++]=i;
			for(int j=2;j*i<=n;++j)
			isprime[i*j]=false;
		}
	}
}
inline int fpow(int a,int b){
	if(b==0) return 1;
	if(a==0) return 0;
	int ans=1,base=a;
	for(;b>0;b/=2){
		if(b&1)ans*=base;
		base=base*base;
	}
	return ans;
}
constexpr int BLOCKSIZE=98;//sqrt(9592)
int block[BLOCKSIZE],bcnt;
int main(){
	n=read();
	int sq=sqrt(double(n));
	init();
	int ans=1;
	int LLCNT=n;
	for(int i=0;i<pcnt;++i){
		int now=primelist[i];
		int answerA,answerB;
		if(primelist[i]<=sq){
			cout<<"B "<<now<<endl;
			cin>>answerB;//!=0
			LLCNT-=answerB;
			cout<<"A "<<now<<endl;
			cin>>answerA;
			int factor=1;
			if(answerA!=0){
				int base=now;
				factor=base;
				for(int j=2;base*now<=n;++j){
					base*=now;
					cout<<"A "<<base<<endl;
					cin>>answerA;
					if(answerA==1)
					factor=base;
					else break;
				}
				ans*=factor;
			}
		}
		else if(ans==1||primelist[i]<=n/2){
			cout<<"B "<<now<<endl;
			block[bcnt++]=now;
			cin>>answerB;
			LLCNT-=answerB;
			if(bcnt==BLOCKSIZE||i==pcnt-1){
				cout<<"A "<<1<<endl;
				int realcnt;
				cin>>realcnt;
				if(realcnt>LLCNT){
					for(int ib=0;ib<bcnt;++ib){
						cout<<"A "<<block[ib]<<endl;
						cin>>answerA;
						if(answerA==1){
							ans*=block[ib];
							bcnt=0;
							break;
						}
					}
				}
				bcnt=0;
			}
		}
		else break;
	}
	cout<<"C "<<ans<<endl;
	return 0;
}


#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();
//			deletenumber=deletelist.size();
			allcnt-=deletenumber;
			cout<<"A "<<thisnum<<'\n';
			fflush(stdout);
			int nowdeletednumber=read();
			int willdeleted=0;
			if(nowdeletednumber!=0){
				int number=thisnum;
				int answer=thisnum;
				while(1){
					int rp=false;
					for(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(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;
}
constexpr int SIZE=1e5+1;
constexpr int PRSIZE=1e4;//cnt=9592
int primelist[PRSIZE],pcnt=0;
bool isprime[SIZE];
int n;
//vector<int>primeval[PRSIZE];
void init(){
	for(int i=2;i<=n;++i) isprime[i]=true;
	for(int i=2;i<=n;++i){
		if(isprime[i]==true){
			primelist[pcnt++]=i;
			for(int j=2;j*i<=n;++j)
			isprime[i*j]=false;
		}
	}
}
inline int fpow(int a,int b){
	if(b==0) return 1;
	if(a==0) return 0;
	int ans=1,base=a;
	for(;b>0;b/=2){
		if(b&1)ans*=base;
		base=base*base;
	}
	return ans;
}
constexpr int BLOCKSIZE=98;//sqrt(9592)
int block[BLOCKSIZE],bcnt;
int main(){
	n=read();
	int sq=sqrt(double(n));
	init();
	int ans=1;
	int LLCNT=n;
	for(int i=0;i<pcnt;++i){
		int now=primelist[i];
		int answerA,answerB;
		if(primelist[i]<=sq){
			cout<<"B "<<now<<endl;
			cin>>answerB;//!=0
			LLCNT-=answerB;
			cout<<"A "<<now<<endl;
			cin>>answerA;
			int factor=1;
			if(answerA!=0){
				int base=now;
				factor=base;
				for(int j=2;base*now<=n;++j){
					base*=now;
					cout<<"A "<<base<<endl;
					cin>>answerA;
					if(answerA==1)
					factor=base;
					else break;
				}
				ans*=factor;
			}
		}
		else if(ans==1){
			cout<<"B "<<now<<endl;
			block[bcnt++]=now;
			cin>>answerB;
			LLCNT-=answerB;
			if(bcnt==BLOCKSIZE||i==pcnt-1){
				cout<<"A "<<1<<endl;
				int realcnt;
				cin>>realcnt;
				if(realcnt>LLCNT){
					for(int ib=0;ib<bcnt;++ib){
						cout<<"A "<<block[ib]<<endl;
						cin>>answerA;
						if(answerA==1){
							ans=block[ib];
							bcnt=0;
							break;
						}
					}
				}
				bcnt=0;
			}
		}
		else break;
	}
	cout<<"C "<<ans<<endl;
	return 0;
}


#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()){
		//	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;
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];
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]>sqrt(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;
}
constexpr int SIZE=1e5+1;
constexpr int PRSIZE=1e4;//cnt=9592
int primelist[PRSIZE],pcnt=0;
bool isprime[SIZE];
int n;
//vector<int>primeval[PRSIZE];
void init(){
	for(int i=2;i<=n;++i) isprime[i]=true;
	for(int i=2;i<=n;++i){
		if(isprime[i]==true){
			primelist[pcnt++]=i;
			for(int j=2;j*i<=n;++j)
			isprime[i*j]=false;
		}
	}
}
inline int fpow(int a,int b){
	if(b==0) return 1;
	if(a==0) return 0;
	int ans=1,base=a;
	for(;b>0;b/=2){
		if(b&1)ans*=base;
		base=base*base;
	}
	return ans;
}
constexpr int BLOCKSIZE=98;//sqrt(9592)
int block[BLOCKSIZE],bcnt;
int main(){
	n=read();
	int sq=sqrt(double(n));
	init();
	int ans=1;
	int LLCNT=n;
	for(int i=0;i<pcnt;++i){
		int now=primelist[i];
		int answerA,answerB;
		if(primelist[i]<=sq){
			cout<<"B "<<now<<endl;
			cin>>answerB;//!=0
			LLCNT-=answerB;
			cout<<"A "<<now<<endl;
			cin>>answerA;
			int factor=1;
			if(answerA!=0){
				int base=now;
				factor=base;
				for(int j=2;base*now<=n;++j){
					base*=now;
					cout<<"A "<<base<<endl;
					cin>>answerA;
					if(answerA==1)
					factor=base;
					else break;
				}
				ans*=factor;
			}
		}
		else if(ans<=sqrt(n)){
			cout<<"B "<<now<<endl;
			block[bcnt++]=now;
			cin>>answerB;
			LLCNT-=answerB;
			if(bcnt==BLOCKSIZE||i==pcnt-1){
				cout<<"A "<<1<<endl;
				int realcnt;
				cin>>realcnt;
				if(realcnt>LLCNT){
					for(int ib=0;ib<bcnt;++ib){
						cout<<"A "<<block[ib]<<endl;
						cin>>answerA;
						if(answerA==1){
							ans*=block[ib];
							bcnt=0;
							break;
						}
					}
				}
				bcnt=0;
			}
		}
		else break;
	}
	cout<<"C "<<ans<<endl;
	return 0;
}


#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);
			cout<<i<<'\n';
		}
	}
	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()==200||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;
}
constexpr int SIZE=1e5+1;
constexpr int PRSIZE=1e4;//cnt=9592
int primelist[PRSIZE],pcnt=0;
bool isprime[SIZE];
int n;
//vector<int>primeval[PRSIZE];
void init(){
	for(int i=2;i<=n;++i) isprime[i]=true;
	for(int i=2;i<=n;++i){
		if(isprime[i]==true){
			primelist[pcnt++]=i;
			for(int j=2;j*i<=n;++j)
			isprime[i*j]=false;
		}
	}
}
inline int fpow(int a,int b){
	if(b==0) return 1;
	if(a==0) return 0;
	int ans=1,base=a;
	for(;b>0;b/=2){
		if(b&1)ans*=base;
		base=base*base;
	}
	return ans;
}
constexpr int BLOCKSIZE=98;//sqrt(9592)
int block[BLOCKSIZE],bcnt;
int main(){
	n=read();
	int sq=sqrt(double(n));
	init();
	int ans=1;
	int LLCNT=n;
	for(int i=0;i<pcnt;++i){
		int now=primelist[i];
		int answerA,answerB;
		if(primelist[i]<=sq){
			cout<<"B "<<now<<endl;
			cin>>answerB;//!=0
			LLCNT-=answerB;
			cout<<"A "<<now<<endl;
			cin>>answerA;
			int factor=1;
			if(answerA!=0){
				int base=now;
				factor=base;
				for(int j=2;base*now<=n;++j){
					base*=now;
					cout<<"A "<<base<<endl;
					cin>>answerA;
					if(answerA==1)
					factor=base;
					else break;
				}
				ans*=factor;
			}
		}
		else if(ans==1||primelist[i]=<n/2){
			cout<<"B "<<now<<endl;
			block[bcnt++]=now;
			cin>>answerB;
			LLCNT-=answerB;
			if(bcnt==BLOCKSIZE||i==pcnt-1){
				cout<<"A "<<1<<endl;
				int realcnt;
				cin>>realcnt;
				if(realcnt>LLCNT){
					for(int ib=0;ib<bcnt;++ib){
						cout<<"A "<<block[ib]<<endl;
						cin>>answerA;
						if(answerA==1){
							ans*=block[ib];
							bcnt=0;
							break;
						}
					}
				}
				bcnt=0;
			}
		}
		else break;
	}
	cout<<"C "<<ans<<endl;
	return 0;
}


#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 {
			//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++;
		}
	}
	if(i>=maxquery-1)assert(1==0);
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}