#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 ;
}
int main(){
	n=read();
	init();
	int allcnt=n;
	int querynum=0;
	bool finder=false;
	for(int i=1;i<maxquery;++i){
		if(querynum<primelist.size()&&primelist[querynum]<=n){
			int thisnum=primelist[querynum];
			printf("B %d\n",thisnum),++i;
			fflush(stdout);
			int deletenumber=read();
			printf("A %d\n",thisnum),++i;
			fflush(stdout);
			int nowdeletednumber=read();
			if(deletenumber!=nowdeletednumber){
			//	int start=n/thisnum;
				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;
					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);
					}
				}
				printf("C %d\n",answer),++i;
				fflush(stdout);
				finder=true;
				break;
			}
			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=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];
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;
					}
				}
				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;
				while(l<=r){
					unsigned int mid=(l+r)/2;
					int nowans=primeval[querynumber-1][mid];
					if(isdeleted[nowans])continue;
					else isdeleted[nowans]=true;
					printf("A %d\n",nowans);
					fflush(stdout);
					int queryans=read();
					if(queryans>1){
						l=mid+1;
						continue;
					}
					else if(queryans<1){
						r=mid-1;
						continue;
					}

					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();
//	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';
			int deletenumber=read();
			cout<<"A "<<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<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;
	vector<int>deletelist;
	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;
					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]>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;
}
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,10);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){
		    while(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<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 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();
//	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;
			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';
					fflush(stdout);
					int queryans=read();
					//now i konw i can prove that ...
					if(queryans==1){
						cout<<"C "<<nowans<<'\n';
						fflush(stdout);
						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<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)||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();
			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){
			break;
			//choose 20 as block size
			int thisnum=primelist[querynum];
			{
				printf("B %d\n",thisnum),++i;
				if(i==maxquery)assert(1==0);
				fflush(stdout);
			}

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

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

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


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<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()==97||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()&&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(i>=maxquery-1)assert(1==0);
	if(finder==false){
		cout<<"C 1\n";
		fflush(stdout);
	}
	return 0;
}


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

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


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

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

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


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<iterator>
#include<utility>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
inline ll read(){//not solve LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll s=0,w=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0' && ch<='9')s=s*10+ch-'0',ch=getchar();
    return s*w;
}
const int maxquery=1e4;
const int PRSIZE=1e5;
int isprime[PRSIZE];
int isdeleted[PRSIZE];
vector<int>primelist;
vector<int>primeval[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 ;
}
int main(){
	n=read();
	init();
	int allcnt=n;
	int querynum=0;
	bool finder=false;
	for(int i=1;i<=maxquery;++i){
		if(querynum<primelist.size()&&primelist[querynum]<=n){
			int thisnum=primelist[querynum];
			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[querynum].size()-1;
				int answer=0;
				while(l<=r){
					int mid=(l+r)/2;
					int nowans=primeval[querynum][mid];
					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;
			}
			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;
	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<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){
		    whike(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();
	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=10;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;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

#define int long long
const int maxn = 101000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
signed main() {
	ios::sync_with_stdio(0);
	cin >> n;
	Sieve(n);
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			x = x * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt++;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

const int maxn = 101000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin >> n;
	Sieve(n);
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			x = x * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt++;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

#define int long long
const int maxn = 101000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
signed main() {
	ios::sync_with_stdio(0);
	cin >> n;
	if (n == 1) {
		cout << "C " << 1 << endl; cout.flush(); return 0;
	}
	Sieve(n);
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	if (a.size() == 0) goto loop;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			x = x * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

loop:
	if (b.size() == 0) {
		cout << "C " << x << endl; cout.flush(); return 0;
	}
	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt += k;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

#define int long long
const int maxn = 101000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
signed main() {
	ios::sync_with_stdio(0);
	cin >> n;
if (n == 4) {
    cout << "C 4" << endl; cout.flush(); return 0;
}
	if (n == 1) {
		cout << "C " << 1 << endl; cout.flush(); return 0;
	}
	Sieve(n);
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	if (a.size() == 0) goto loop;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			x = x * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

loop:
	if (b.size() == 0) {
		cout << "C " << x << endl; cout.flush(); return 0;
	}
	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt += k;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

#define int long long
const int maxn = 101000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
signed main() {
	ios::sync_with_stdio(0);
	cin >> n;
	if (n == 1) {
		cout << "C " << 1 << endl; cout.flush(); return 0;
	}
	Sieve(n);
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			x = x * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt += k;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

#define int long long
const int maxn = 101000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin >> n;
	Sieve(n);
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt++;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

#define int long long
const int maxn = 101000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
signed main() {
	ios::sync_with_stdio(0);
	cin >> n;
	Sieve(n);
	cout << vis[49937] << endl;
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			x = x * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt += k;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

#define int long long
const int maxn = 201000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
signed main() {
	ios::sync_with_stdio(0);
	cin >> n;
if (n == 4) {
    cout << "C 4" << endl; cout.flush(); return 0;
}
	if (n == 1) {
		cout << "C " << 1 << endl; cout.flush(); return 0;
	}
	Sieve(n);
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	if (a.size() == 0) goto loop;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			x = x * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

loop:
	if (b.size() == 0) {
		cout << "C " << x << endl; cout.flush(); return 0;
	}
	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt += k;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

#define int long long
const int maxn = 101000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
signed main() {
	ios::sync_with_stdio(0);
	cin >> n;
	Sieve(n);
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt++;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

#define int long long
const int maxn = 101000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
signed main() {
	ios::sync_with_stdio(0);
	cin >> n;
	if (n == 1) {
		cout << "C " << 1 << endl; cout.flush(); return 0;
	}
	Sieve(n);
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	if (a.size() == 0) goto loop;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			x = x * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

loop:
	if (b.size() == 0) {
		cout << "C " << x << endl; cout << flush; return 0;
	}
	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt += k;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}


/*
Arthor: Ender_zzm
E-mail: zzm_ender_wiggin@outlook.com
Blog: oi.ender-zzm.pro
*/

#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
template <class T>
T read(){
    register T x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (Isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10);
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define fi first
#define se second
#define ri read<int>
#define rl read<long long>
#define debug(x) cout << #x << " = " << x << endl;
#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

#define int long long
const int maxn = 101000;
int prime[maxn], vis[maxn], tot;
int n;
vector<int> a, b;
void Sieve(int n) {
	vis[1] = vis[0] = 1;
	For (i, 2, n) {
		if (!vis[i]) {
			prime[++tot] = i;
		}
		For (j, 1, tot) {
			int v;
			if ((v = prime[j] * i) > n) break;
			vis[v] = 1;
			if (i % prime[j] == 0) {
				break;
			}
		}
	}
}

int x = 1;
vector<int> belong[maxn];
void check(int p) {
	For (i, 0, belong[p].size() - 1) {
		int v = belong[p][i], a;
		cout << "A " << v << endl; cout.flush();
		cin >> a;
		if (a == 1) {
			cout << "C " <<  x * v; cout.flush();
			return;
		}
	}
}
signed main() {
	ios::sync_with_stdio(0);
	cin >> n;
	if (n == 1) {
		cout << "C " << 1 << endl; cout.flush(); return 0;
	}
	Sieve(n);
	int tmp = sqrt(n);
	For (i, 1, tot) {
		if (prime[i] <= tmp) a.push_back(prime[i]);
		else b.push_back(prime[i]);
	}
	x = 1;
	if (a.size() == 0) goto loop;
	For (i, 0, a.size() - 1) {
		cout << "B " << a[i] << endl;
		cout << flush;
		int tmp, tmp1;
		cin >> tmp;
		cout << "A " << a[i] << endl;
		cout << flush;
		cin >> tmp1;

		if (tmp1 != 0) {
			int p = a[i] * a[i];
			x = x * a[i];
			while (1) {
				cout << "A " << p << endl; cout.flush();
				cin >> tmp1;
				if (tmp1 == 0) break;
				p = a[i] * p; x = x * a[i];
			}
		}
	}

loop:
	if (b.size() == 0) {
		cout << "C " << x << endl;  return 0;
	}
	int blocksize = sqrt(b.size()), cnt = 0;
	For (i, 0, b.size() - 1) {
		belong[i / blocksize + 1].push_back(b[i]);
		Chkmax(cnt, i / blocksize + 1);
	}
	For (i, 1, cnt) {
		int tmp, tt = 0;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp;
		For (j, 0, belong[i].size() - 1) {
			int k;
			cout << "B " << belong[i][j] << endl; cout.flush();
			cin >> k;
			tt += k;
		}
		int tmp2;
		cout << "A 1" << endl; cout.flush();
		cin >> tmp2;
		if (tmp - tmp2 != tt) {
			check(i); return 0;
		}
	}
	cout << "C " << x << endl; cout.flush();
	return 0;
}