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

// Hate My Life //

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#endif

#define SMAX 100010
vi prime;
int lp[SMAX];

void sieve (int lim) {
    lp[1]=1; //cross-check again
    fol(i,2,lim+1) {
        if (lp[i]==0) {
            prime.pb(i);
            lp[i]=i;
        }
        forr(x,prime) {
            if (x*i > lim) break;
            lp[x*i] = x;
            if (i%x == 0) break;
        }
    }
}

int query (char ch, int val) {
    cout << ch << " " << val << endl;
    int ans;
    cin >> ans;
    return ans;
}

int white_horseman()
{
    lli n, m, k, q, u, v, temp=0, ans=0;
    cin >> n;

    sieve(n);
    fol(i,0,n+1) lp[i] = 1;

    vi curslide, factors;
    bool fl = 0;
    int expected = n;

    forr(x,prime) {
        if (x > n) break;
        int cnt = 0;
        for(int j = x; j <=n; j+=x) cnt += lp[j];
        trace(cnt)
        if (query('B',x) != cnt) factors.pb(x);
        curslide.pb(x);
        if (fl || (sz(curslide) < 100 && x != prime.back())) {}
        else if (query('A',1) != expected) {
            forr(x,curslide) if (query('A',x)) {
                factors.pb(x);
                break;
            }
            curslide.clear();
            fl = 1;
        }
        for(int j = x; j <=n; j+=x)
            if (lp[j]) lp[j] = 0, expected--;
    }
    cotra(factors)
    sort(all(factors));
    factors.erase(unique(all(factors)),factors.end());
    ans = 1;
    forr(x,factors) {
        lli val = 1LL * x * x;
        ans *= x;
        while (query('A',val)) {
            ans *= x;
            val *= x;
        }
    }
    cout << 'C' << " " << ans << endl;
    return 0;
}

signed main()
{
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) {
        //cout<<"Case #"<<i+1<<": ";
        white_horseman();
    }
    end_routine(); if(localsys) system("pause");
}


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

// Hate My Life //

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#endif

#define SMAX 100010
vi prime;
int lp[SMAX];

void sieve (int lim) {
    lp[1]=1; //cross-check again
    fol(i,2,lim+1) {
        if (lp[i]==0) {
            prime.pb(i);
            lp[i]=i;
        }
        forr(x,prime) {
            if (x*i > lim) break;
            lp[x*i] = x;
            if (i%x == 0) break;
        }
    }
}

int query (char ch, int val) {
    cout << ch << " " << val << endl;
    int ans;
    cin >> ans;
    return ans;
}

int white_horseman()
{
    lli n, m, k, q, u, v, temp=0, ans=1;
    cin >> n;

    sieve(n);
    fol(i,0,n+1) lp[i] = 1;

    vi curslide, factors;
    bool fl = 0;
    int expected = n;

    forr(x,prime) {
        if (x > n) break;

        int cnt = 0;
        for(int j = x; j <=n; j+=x) cnt += lp[j];
        trace(cnt)

        if (query('B',x) != cnt) factors.pb(x);

        curslide.pb(x);
        for(int j = x; j <=n; j+=x)
            if (lp[j]) lp[j] = 0, expected--;
        trace(expected)

        if (fl || sz(curslide) < 100) continue;
        if (query('A',1) != expected) {
            forr(x,curslide) if (query('A',x)) {
                factors.pb(x);
                break;
            }
            fl = 1;
        }
        curslide.clear();
    }

    if (fl) {
        forr(x,curslide) if (query('A',x)) {
            factors.pb(x);
            break;
        }
    }

    sort(all(factors));
    factors.erase(unique(all(factors)),factors.end());

    forr(x,factors) {
        lli val = 1LL * x * x;
        ans *= x;
        while (query('A',val)) {
            ans *= x;
            val *= x;
        }
    }

    cout << 'C' << " " << ans << endl;

    return 0;
}

signed main()
{
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) {
        //cout<<"Case #"<<i+1<<": ";
        white_horseman();
    }
    end_routine(); if(localsys) system("pause");
}


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

// Hate My Life //

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#endif

#define SMAX 100010
vi prime;
int lp[SMAX];

void sieve (int lim) {
    lp[1]=1; //cross-check again
    fol(i,2,lim+1) {
        if (lp[i]==0) {
            prime.pb(i);
            lp[i]=i;
        }
        forr(x,prime) {
            if (x*i > lim) break;
            lp[x*i] = x;
            if (i%x == 0) break;
        }
    }
}

int query (char ch, int val) {
    cout << ch << " " << val << endl;
    int ans;
    cin >> ans;
    return ans;
}

int white_horseman()
{
    lli n, m, k, q, u, v, temp=0, ans=1;
    cin >> n;

    sieve(n);
    trace(lp[99991])
    fol(i,0,n+1) lp[i] = 1;

    vi curslide, factors;
    bool fl = 0;
    int expected = n;

    forr(x,prime) {
        if (x > n) break;

        int cnt = 0;
        for(int j = x; j <=n; j+=x) cnt += lp[j];
        trace(cnt)

        if (query('B',x) != cnt) factors.pb(x);

        curslide.pb(x);
        for(int j = x; j <=n; j+=x)
            if (lp[j]) lp[j] = 0, expected--;

        if (fl) continue;

        if (sz(curslide) < 100) continue;

        trace(expected)
        if (query('A',1) != expected) {
            forr(y,curslide) if (query('A',y)) {
                factors.pb(y);
                break;
            }
            fl = 1;
        }

        curslide.clear();
    }

    if (!fl) {
        forr(x,curslide) if (query('A',x)) {
            factors.pb(x);
            break;
        }
    }

    sort(all(factors));
    factors.erase(unique(all(factors)),factors.end());

    forr(x,factors) {
        lli val = 1LL * x * x;
        ans *= x;
        while (val <= n && query('A',val)) {
            ans *= x;
            val *= x;
        }
    }

    cout << 'C' << " " << ans << endl;

    return 0;
}

signed main()
{
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) {
        //cout<<"Case #"<<i+1<<": ";
        white_horseman();
    }
    end_routine(); if(localsys) system("pause");
}


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

// Hate My Life //

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#endif

#define SMAX 100010
vi prime;
int lp[SMAX];

void sieve (int lim) {
    lp[1]=1; //cross-check again
    fol(i,2,lim+1) {
        if (lp[i]==0) {
            prime.pb(i);
            lp[i]=i;
        }
        forr(x,prime) {
            if (x*i > lim) break;
            lp[x*i] = x;
            if (i%x == 0) break;
        }
    }
}

int query (char ch, int val) {
    cout << ch << " " << val << endl;
    int ans;
    cin >> ans;
    return ans;
}

int white_horseman()
{
    lli n, m, k, q, u, v, temp=0, ans=0;
    cin >> n;

    sieve(n);
    fol(i,0,n+1) lp[i] = 1;

    vi curslide, factors;
    bool fl = 0;

    forr(x,prime) {
        if (x > n) break;
        int cnt = 0;
        for(int j = x; j <=n; j+=x) cnt += lp[j];
        trace(cnt)
        if (query('B',x) != cnt) factors.pb(x);
        curslide.pb(x);
        if (fl) {}
        else if (sz(curslide) >= 100 || x == prime.back()) {
            forr(x,curslide) if (query('A',x)) {
                factors.pb(x);
                fl = 1;
                break;
            }
        }
        for(int j = x; j <=n; j+=x) lp[j] = 0;
    }
    cotra(factors)
    sort(all(factors));
    factors.erase(unique(all(factors)),factors.end());
    ans = 1;
    forr(x,factors) {
        lli val = 1LL * x * x;
        ans *= x;
        while (query('A',val)) {
            ans *= x;
            val *= x;
        }
    }
    cout << 'C' << " " << ans << endl;
    return 0;
}

signed main()
{
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) {
        //cout<<"Case #"<<i+1<<": ";
        white_horseman();
    }
    end_routine(); if(localsys) system("pause");
}


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

// Hate My Life //

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#endif

#define SMAX 100010
vi prime;
int lp[SMAX];

void sieve (int lim) {
    lp[1]=1; //cross-check again
    fol(i,2,lim+1) {
        if (lp[i]==0) {
            prime.pb(i);
            lp[i]=i;
        }
        forr(x,prime) {
            if (x*i > lim) break;
            lp[x*i] = x;
            if (i%x == 0) break;
        }
    }
}

int query (char ch, int val) {
    cout << ch << " " << val << endl;
    int ans;
    cin >> ans;
    return ans;
}

int white_horseman()
{
    lli n, m, k, q, u, v, temp=0, ans=0;
    cin >> n;

    sieve(n);
    fol(i,0,n+1) lp[i] = 1;

    vi curslide, factors;
    bool fl = 0;

    forr(x,prime) {
        if (x > n) break;
        int cnt = 0;
        for(int j = x; j <=n; j+=x) cnt += lp[j];
        trace(cnt)
        if (query('B',x) != cnt) factors.pb(x);
        curslide.pb(x);
        if (fl) {}
        else if (sz(curslide) >= 100 || x == prime.back()) {
            forr(x,curslide) if (query('A',x)) {
                factors.pb(x);
                break;
            }
            fl = 1;
        }
        for(int j = x; j <=n; j+=x) lp[j] = 0;
    }
    cotra(factors)
    sort(all(factors));
    factors.erase(unique(all(factors)),factors.end());
    ans = 1;
    forr(x,factors) {
        lli val = 1LL * x * x;
        ans *= x;
        while (query('A',val)) {
            ans *= x;
            val *= x;
        }
    }
    cout << 'C' << " " << ans << endl;
    return 0;
}

signed main()
{
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) {
        //cout<<"Case #"<<i+1<<": ";
        white_horseman();
    }
    end_routine(); if(localsys) system("pause");
}


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

// Hate My Life //

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#endif

#define SMAX 100010
vi prime;
int lp[SMAX];

void sieve (int lim) {
    lp[1]=1; //cross-check again
    fol(i,2,lim+1) {
        if (lp[i]==0) {
            prime.pb(i);
            lp[i]=i;
        }
        forr(x,prime) {
            if (x*i > lim) break;
            lp[x*i] = x;
            if (i%x == 0) break;
        }
    }
}

int query (char ch, int val) {
    cout << ch << " " << val << endl;
    int ans;
    cin >> ans;
    return ans;
}

int white_horseman()
{
    lli n, m, k, q, u, v, temp=0, ans=1;
    cin >> n;

    sieve(n);
    fol(i,0,n+1) lp[i] = 1;

    vi curslide, factors;
    bool fl = 0;
    int expected = n;

    forr(x,prime) {
        if (x > n) break;

        int cnt = 0;
        for(int j = x; j <=n; j+=x) cnt += lp[j];
        trace(cnt)

        if (query('B',x) != cnt) factors.pb(x);

        curslide.pb(x);
        for(int j = x; j <=n; j+=x)
            if (lp[j]) lp[j] = 0, expected--;

        if (fl || sz(curslide) < 100) continue;

        trace(expected)
        if (query('A',1) != expected) {
            forr(x,curslide) if (query('A',x)) {
                factors.pb(x);
                break;
            }
            fl = 1;
        }
        curslide.clear();
    }

    if (!fl) {
        forr(x,curslide) if (query('A',x)) {
            factors.pb(x);
            break;
        }
    }

    sort(all(factors));
    factors.erase(unique(all(factors)),factors.end());

    forr(x,factors) {
        lli val = 1LL * x * x;
        ans *= x;
        while (query('A',val)) {
            ans *= x;
            val *= x;
        }
    }

    cout << 'C' << " " << ans << endl;

    return 0;
}

signed main()
{
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) {
        //cout<<"Case #"<<i+1<<": ";
        white_horseman();
    }
    end_routine(); if(localsys) system("pause");
}


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

// Hate My Life //

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#endif

#define SMAX 100010
vi prime;
int lp[SMAX];

void sieve (int lim) {
    lp[1]=1; //cross-check again
    fol(i,2,lim+1) {
        if (lp[i]==0) {
            prime.pb(i);
            lp[i]=i;
        }
        forr(x,prime) {
            if (x*i > lim) break;
            lp[x*i] = x;
            if (i%x == 0) break;
        }
    }
}

int query (char ch, int val) {
    cout << ch << " " << val << endl;
    static int ans;
    cin >> ans;
    return ans;
}

int white_horseman()
{
    lli n, m, k, q, u, v, temp=0, ans=1;
    cin >> n;

    sieve(n);
    fol(i,0,n+1) lp[i] = 1;

    vi curslide, factors;
    bool fl = 0;
    int expected = n, lim = sqrt(sz(prime));

    forr(x,prime) {
        if (x > n) break;

        int cnt = 0;
        for(int j = x; j <=n; j+=x) cnt += lp[j];
        trace(cnt)

        if (query('B',x) != cnt) factors.pb(x);

        for(int j = x; j <=n; j+=x)
            if (lp[j]) lp[j] = 0, expected--;

        if (fl) continue;

        curslide.pb(x);
        if (sz(curslide) < lim) continue;

        trace(expected)
        if (query('A',1) != expected) {
            forr(y,curslide) if (query('A',y)) {
                factors.pb(y);
                break;
            }
            fl = 1;
        }

        curslide.clear();
    }

    if (!fl) {
        forr(x,curslide) if (query('A',x)) {
            factors.pb(x);
            break;
        }
    }

    sort(all(factors));
    factors.erase(unique(all(factors)),factors.end());

    forr(x,factors) {
        lli val = 1LL * x * x;
        ans *= x;
        while (val <= n && query('A',val)) {
            ans *= x;
            val *= x;
        }
    }

    cout << 'C' << " " << ans << endl;

    return 0;
}

signed main()
{
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) {
        //cout<<"Case #"<<i+1<<": ";
        white_horseman();
    }
    end_routine(); if(localsys) system("pause");
}


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

// Hate My Life //

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#endif

#define SMAX 100010
vi prime;
int lp[SMAX];

void sieve (int lim) {
    lp[1]=1; //cross-check again
    fol(i,2,lim+1) {
        if (lp[i]==0) {
            prime.pb(i);
            lp[i]=i;
        }
        forr(x,prime) {
            if (x*i > lim) break;
            lp[x*i] = x;
            if (i%x == 0) break;
        }
    }
}

int query (char ch, int val) {
    cout << ch << " " << val << endl;
    int ans;
    cin >> ans;
    return ans;
}

int white_horseman()
{
    lli n, m, k, q, u, v, temp=0, ans=0;
    cin >> n;

    sieve(n);
    fol(i,0,n+1) lp[i] = 1;

    vi curslide, factors;
    bool fl = 0;

    forr(x,prime) {
        if (x > n) break;
        int cnt = 0;
        for(int j = x; j <=n; j+=x) cnt += lp[j];
        trace(cnt)
        if (query('B',x) != cnt) factors.pb(x);
        curslide.pb(x);
        // if (fl) {}
        // else if (sz(curslide) >= 100 || x == prime.back()) {
        //     forr(x,curslide) if (query('A',x)) {
        //         factors.pb(x);
        //         fl = 1;
        //         break;
        //     }
        //     curslide.clear();
        // }
        for(int j = x; j <=n; j+=x) lp[j] = 0;
    }
    cotra(factors)
    sort(all(factors));
    factors.erase(unique(all(factors)),factors.end());
    ans = 1;
    forr(x,factors) {
        lli val = 1LL * x * x;
        ans *= x;
        while (query('A',val)) {
            ans *= x;
            val *= x;
        }
    }
    cout << 'C' << " " << ans << endl;
    return 0;
}

signed main()
{
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) {
        //cout<<"Case #"<<i+1<<": ";
        white_horseman();
    }
    end_routine(); if(localsys) system("pause");
}


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

// Hate My Life //

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#endif

#define SMAX 100010
vi prime;
int lp[SMAX];

void sieve (int lim) {
    lp[1]=1; //cross-check again
    fol(i,2,lim+1) {
        if (lp[i]==0) {
            prime.pb(i);
            lp[i]=i;
        }
        forr(x,prime) {
            if (x*i > lim) break;
            lp[x*i] = x;
            if (i%x == 0) break;
        }
    }
}

int query (char ch, int val) {
    cout << ch << " " << val << endl;
    int ans;
    cin >> ans;
    return ans;
}

int white_horseman()
{
    lli n, m, k, q, u, v, temp=0, ans=1;
    cin >> n;

    sieve(n);
    fol(i,0,n+1) lp[i] = 1;

    vi curslide, factors;
    bool fl = 0;
    int expected = n;

    forr(x,prime) {
        if (x > n) break;

        int cnt = 0;
        for(int j = x; j <=n; j+=x) cnt += lp[j];
        trace(cnt)

        if (query('B',x) != cnt) factors.pb(x);

        curslide.pb(x);
        for(int j = x; j <=n; j+=x)
            if (lp[j]) lp[j] = 0, expected--;
        trace(expected)

        if (fl || (sz(curslide) < 100 && x != prime.back())) continue;
        if (query('A',1) != expected) {
            forr(x,curslide) if (query('A',x)) {
                factors.pb(x);
                break;
            }
            fl = 1;
        }
        curslide.clear();
    }

    sort(all(factors));
    factors.erase(unique(all(factors)),factors.end());

    forr(x,factors) {
        lli val = 1LL * x * x;
        ans *= x;
        while (query('A',val)) {
            ans *= x;
            val *= x;
        }
    }

    cout << 'C' << " " << ans << endl;

    return 0;
}

signed main()
{
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) {
        //cout<<"Case #"<<i+1<<": ";
        white_horseman();
    }
    end_routine(); if(localsys) system("pause");
}


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

// Hate My Life //

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#endif

#define SMAX 100010
vi prime;
int lp[SMAX];

void sieve (int lim) {
    lp[1]=1; //cross-check again
    fol(i,2,lim+1) {
        if (lp[i]==0) {
            prime.pb(i);
            lp[i]=i;
        }
        forr(x,prime) {
            if (x*i > lim) break;
            lp[x*i] = x;
            if (i%x == 0) break;
        }
    }
}

int query (char ch, int val) {
    cout << ch << " " << val << endl;
    int ans;
    cin >> ans;
    return ans;
}

int white_horseman()
{
    lli n, m, k, q, u, v, temp=0, ans=1;
    cin >> n;

    sieve(n);
    fol(i,0,n+1) lp[i] = 1;

    vi curslide, factors;
    bool fl = 0;
    int expected = n, lim = sqrt(sz(prime));

    forr(x,prime) {
        if (x > n) break;

        int cnt = 0;
        for(int j = x; j <=n; j+=x) cnt += lp[j];
        trace(cnt)

        if (query('B',x) != cnt) factors.pb(x);

        for(int j = x; j <=n; j+=x)
            if (lp[j]) lp[j] = 0, expected--;

        if (fl) continue;

        curslide.pb(x);
        if (sz(curslide) < 100) continue;

        trace(expected)
        if (query('A',1) != expected) {
            forr(y,curslide) if (query('A',y)) {
                factors.pb(y);
                break;
            }
            fl = 1;
        }

        curslide.clear();
    }

    if (!fl) {
        forr(x,curslide) if (query('A',x)) {
            factors.pb(x);
            break;
        }
    }

    sort(all(factors));
    factors.erase(unique(all(factors)),factors.end());

    forr(x,factors) {
        lli val = 1LL * x * x;
        ans *= x;
        while (val <= n && query('A',val)) {
            ans *= x;
            val *= x;
        }
    }

    cout << 'C' << " " << ans << endl;

    return 0;
}

signed main()
{
    if(!localsys) { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) {
        //cout<<"Case #"<<i+1<<": ";
        white_horseman();
    }
    end_routine(); if(localsys) system("pause");
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ar array

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 1e5 + 5;

int A(int num) {
  cout << "A " << num << endl;
  int x; cin >> x;
  return x;
}

int B(int num) {
  cout << "B " << num << endl;
  int x; cin >> x;
  return x;
}

vector<int> pr, small, big;
int N;
bool have[maxn];
int cnt[maxn], res[maxn];

signed main(void) {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  /*#ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL*/

  auto prime = [&](int x) {
    for (int i = 2; i * i <= x; ++i) {
      if (x % i == 0) {
        return false;
      }
    }
    return true;
  };
  cin >> N;
  for (int i = 2; i <= N; ++i) {
    if (prime(i)) {
      pr.eb(i);
    }
  }
  int sq = sqrt(N);
  for (int & i : pr) {
    if (i <= sq) {
      B(i);
      small.eb(i);
    } else {
      big.eb(i);
    }
  }
  int res = 1;
  for (int & i : small) {
    int j = i;
    while (j <= N && A(j)) {
      j *= i;
    }
    j /= i;
    res *= j;
    //cerr << "adf" << j << ' ';
  }

  if (res > sq) {
    cout << "C " << res;
    return 0;
  }

  int l = 0, r = big.size() - 1, mid;
  while (l <= r) {
    mid = (l + r) / 2;
    int num = A(1), cnum = num;
    for (int i = 0; i <= mid; ++i) {
      if (B(big[i])) {
        --cnum;
      }
    }
    if (A(1) == cnum) {
      l = mid + 1;
    }
    else {
      for (int i = l; i <= mid; ++i) {
        if (B(big[i])) {
          res *= big[i];
          break;
        }
      }
      break;
    }
  }

  cout << "C " << res;
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ar array

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 1e5 + 5;
const int local = 0;

int ask = 0;
set<int> s;
int X, N;

int A(int num) {
  if (num > N) return 0;
  ++ask;
  if (!local) {
    cout << "A " << num << endl;
    int x; cin >> x;
    return x;
  } else {
    int ret = 0;
    for (int it : s) {
      if (it % num == 0)
        ++ret;
    }
    return ret;
  }
}

int B(int num) {
  if (num > N) return 0;
  ++ask;
  assert(num != 1);
  if (!local) {
    cout << "B " << num << endl;
    int x; cin >> x;
    return x;
  } else {
    int ret = 0;
		vector<int> del;
		for (int a : s) {
      if (a % num == 0) {
        ret++;
        if(a != X) del.push_back(a);
      }
		}
		for (int a : del) s.erase(a);
		return ret;
  }
}

void C(int num) {
  if (local) {
    assert(num == X);
  }
  ++ask;
  cout << "C " << num;
}

vector<int> pr, small, big;
int res = 1;

void init(void) {
  cin >> X;
  for (int i = 1; i <= N; ++i) {
    s.insert(i);
  }
}

signed main(void) {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL

  auto prime = [&](int x) {
    for (int i = 2; i * i <= x; ++i) {
      if (x % i == 0) {
        return false;
      }
    }
    return true;
  };
  cin >> N;
  if (local) {
    init();
  }
  for (int i = 2; i <= N; ++i) {
    if (prime(i)) {
      pr.eb(i);
    }
  }
  int sq = sqrt(N);
  for (int & i : pr) {
    if (i <= sq) {
      B(i);
      small.eb(i);
    } else {
      big.eb(i);
    }
  }
  for (int & i : small) {
    int j = i;
    while (j <= N && A(j)) {
      j *= i;
    }
    j /= i;
    res *= j;
    //cerr << "adf" << j << ' ';
  }

  int num = A(1);
  bool ok = false;
  while (big.size()) {
    vector<int> v1, v2;
    for (int i = 0; i < (int)big.size(); ++i) {
      if (i & 1) {
        v2.eb(big[i]);
      } else {
        v1.eb(big[i]);
      }
    }
    int cnum = num;
    bool kt = false;
    for (int it : v1) {
      if (B(it) == 2) {
        res *= it;
        kt = true;
        break;
      }
      --cnum;
    }
    if (kt) break;
    num = A(1);
    if (cnum == num) {
      swap(big, v2);
    } else {
      swap(big, v1);
      ok = true;
      break;
    }
  }
  if (ok) {
    for (int & i : big) {
      if (B(i)) {
        res *= i;
      }
    }
  }
  cerr << ask;
  assert(ask <= 10000);
  C(res);
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ar array

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 1e5 + 5;

int A(int num) {
  cout << "A " << num << endl;
  int x; cin >> x;
  return x;
}

int B(int num) {
  cout << "B " << num << endl;
  int x; cin >> x;
  return x;
}

vector<int> pr, vi, big;
int N;
bool have[maxn];
int cnt[maxn], res[maxn];

signed main(void) {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  /*#ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL*/

  auto prime = [&](int x) {
    for (int i = 2; i * i <= x; ++i) {
      if (x % i == 0) {
        return false;
      }
    }
    return true;
  };
  cin >> N;
  for (int i = 2; i <= N; ++i) {
    if (prime(i)) {
      pr.eb(i);
    }
  }
  int sq = sqrt(N);
  for (int & i : pr) {
    if (i <= sq) {
      B(i);
      if (A(i)) {
        vi.eb(i);
      }
    } else {
      big.eb(i);
    }
  }
  int res = 1;
  for (int & i : vi) {
    int j = i;
    while (j <= N && A(j)) {
      j *= i;
    }
    j /= i;
    res *= j;
    //cerr << "adf" << j << ' ';
  }

  if (res > sq) {
    cout << "C " << res;
    return 0;
  }

  int l = 0, r = big.size() - 1, mid;
  while (l <= r) {
    mid = (l + r) / 2;
    int num = A(1), cnum = num;
    for (int i = 0; i <= mid; ++i) {
      if (B(big[i])) {
        --cnum;
      }
    }
    if (A(1) == cnum) {
      l = mid + 1;
    }
    else {
      r = mid - 1;
    }
  }
  if (l < big.size()) {
    res *= big[l];
  }

  cout << "C " << res;
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ar array

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 1e5 + 5;
const int local = 0;

int ask = 0;
set<int> s;
int X, N;

int A(int num) {
  if (num > N) return 0;
  ++ask;
  if (!local) {
    cout << "A " << num << endl;
    int x; cin >> x;
    return x;
  } else {
    int ret = 0;
    for (int it : s) {
      if (it % num == 0)
        ++ret;
    }
    return ret;
  }
}

int B(int num) {
  if (num > N) return 0;
  ++ask;
  assert(num != 1);
  if (!local) {
    cout << "B " << num << endl;
    int x; cin >> x;
    return x;
  } else {
    int ret = 0;
		vector<int> del;
		for (int a : s) {
      if (a % num == 0) {
        ret++;
        if(a != X) del.push_back(a);
      }
		}
		for (int a : del) s.erase(a);
		return ret;
  }
}

void C(int num) {
  if (local) {
    assert(num == X);
  }
  ++ask;
  cout << "C " << num;
}

vector<int> pr, small, big;
int res = 1;

void init(void) {
  cin >> X;
  for (int i = 1; i <= N; ++i) {
    s.insert(i);
  }
}

signed main(void) {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL

  auto prime = [&](int x) {
    for (int i = 2; i * i <= x; ++i) {
      if (x % i == 0) {
        return false;
      }
    }
    return true;
  };
  cin >> N;
  if (local) {
    init();
  }
  for (int i = 2; i <= N; ++i) {
    if (prime(i)) {
      pr.eb(i);
    }
  }
  int sq = sqrt(N);
  for (int & i : pr) {
    if (i <= sq) {
      B(i);
      small.eb(i);
    } else {
      big.eb(i);
    }
  }
  for (int & i : small) {
    int j = i;
    while (j <= N && A(j)) {
      j *= i;
    }
    j /= i;
    res *= j;
    //cerr << "adf" << j << ' ';
  }

  int num = A(1);
  bool ok = false;
  while (big.size()) {
    vector<int> v1, v2;
    for (int i = 0; i < (int)big.size(); ++i) {
      if (i & 1) {
        v2.eb(big[i]);
      } else {
        v1.eb(big[i]);
      }
    }
    int cnum = num;
    for (int it : v1) {
      assert(B(it));
      --cnum;
    }
    num = A(1);
    if (cnum == num) {
      swap(big, v2);
    } else {
      swap(big, v1);
      ok = true;
      break;
    }
  }
  if (ok) {
    for (int & i : big) {
      if (B(i)) {
        res *= i;
      }
    }
  }
  cerr << ask << '\n';
  assert(ask <= 10000);
  return 0;
  C(res);
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ar array

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 1e5 + 5;
const int local = 0;

int ask = 0;
set<int> s;
int X, N;

int A(int num) {
  if (num > N) return 0;
  ++ask;
  if (!local) {
    cout << "A " << num << endl;
    int x; cin >> x;
    return x;
  } else {
    int ret = 0;
    for (int it : s) {
      if (it % num == 0)
        ++ret;
    }
    return ret;
  }
}

int B(int num) {
  if (num > N) return 0;
  ++ask;
  assert(num != 1);
  if (!local) {
    cout << "B " << num << endl;
    int x; cin >> x;
    return x;
  } else {
    int ret = 0;
		vector<int> del;
		for (int a : s) {
      if (a % num == 0) {
        ret++;
        if(a != X) del.push_back(a);
      }
		}
		for (int a : del) s.erase(a);
		return ret;
  }
}

void C(int num) {
  if (local) {
    assert(num == X);
  }
  ++ask;
  cout << "C " << num;
}

vector<int> pr, small, big;
int res = 1;

void init(void) {
  cin >> X;
  for (int i = 1; i <= N; ++i) {
    s.insert(i);
  }
}

signed main(void) {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL

  auto prime = [&](int x) {
    for (int i = 2; i * i <= x; ++i) {
      if (x % i == 0) {
        return false;
      }
    }
    return true;
  };
  cin >> N;
  if (local) {
    init();
  }
  for (int i = 2; i <= N; ++i) {
    if (prime(i)) {
      pr.eb(i);
    }
  }
  int sq = sqrt(N);
  for (int & i : pr) {
    if (i <= sq) {
      B(i);
      small.eb(i);
    } else {
      big.eb(i);
    }
  }
  for (int & i : small) {
    int j = i;
    while (j <= N && A(j)) {
      j *= i;
    }
    j /= i;
    res *= j;
    //cerr << "adf" << j << ' ';
  }

  int num = A(1);
  bool ok = false;
  while (big.size()) {
    vector<int> v1, v2;
    for (int i = 0; i < (int)big.size(); ++i) {
      if (i & 1) {
        v2.eb(big[i]);
      } else {
        v1.eb(big[i]);
      }
    }
    int cnum = num;
    for (int it : v1) {
      assert(B(it));
      --cnum;
    }
    num = A(1);
    if (cnum == num) {
      swap(big, v2);
    } else {
      swap(big, v1);
      ok = true;
      break;
    }
  }
  if (ok) {
    for (int & i : big) {
      if (B(i)) {
        res *= i;
      }
    }
  }
  cerr << ask << '\n';
  assert(ask <= 10000);
  C(res);
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector <bool> vis(n+1,true);
        vector <int> v;
        vector <int> v1;
        for(ll i=2;i<=n;i++){
            if(vis[i]==true){
                v.push_back(i);
                int ctr=0;
                for(ll j=i*i;j<=n;j+=i){
                    ctr+=(vis[j]==true);
                    vis[j]=false;
                }
                v1.push_back(ctr+1);
            }
        }
        int m=v1.size();
        vector <int> v2(m,0);
        int ctr=0;
        int check=0;
        vector <ll> ans;
        for(int i=0;i<m;){
            for(int j=0;j<100&&i+j<m;j++){
                cout<<"B "<<v[i+j]<<endl;
                fflush(stdout);
                cin>>v2[i+j];
                ctr+=v1[i+j];
                if(v2[i+j]>v1[i+j])
                    ans.push_back(v[i+j]);
            }
            if(check==0){
                cout<<"A 1"<<endl;
                fflush(stdout);
                int val;
                cin>>val;
                if(n-ctr<val){
                    check=1;
                    for(int j=0;j<100&&i+j<m;j++){
                        cout<<"A "<<v[i+j]<<endl;
                        fflush(stdout);
                        int val1;
                        cin>>val1;
                        if(val1!=0)
                            ans.push_back(v[i+j]);
                    }
                }
            }
            i+=100;
        }
        if(check==0){
            cout<<"C 1"<<endl;
            fflush(stdout);
        }
        else{
            ll ans1=1ll;
            for(int i=0;i<ans.size();i++){
                ll val1=ans[i];
                while(1){
                    if(val1*ans[i]<=n){
                        cout<<"A "<<(val1*ans[i])<<endl;
                        fflush(stdout);
                        int val;
                        cin>>val;
                        if(val>0){
                            val1*=ans[i];
                        }
                        else{
                            break;
                        }
                    }
                    else
                        break;
                }
                ans1*=val1;
            }
            cout<<"C "<<ans1<<endl;
            fflush(stdout);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector <bool> vis(n+1,true);
        vector <int> v;
        vector <int> v1;
        for(ll i=2;i<=n;i++){
            if(vis[i]==true){
                v.push_back(i);
                int ctr=0;
                for(ll j=i*i;j<=n;j+=i){
                    ctr+=(vis[j]==true);
                    vis[j]=false;
                }
                v1.push_back(ctr+1);
            }
        }
        int m=v1.size();
        vector <int> v2(m,0);
        int ctr=0;
        int check=0;
        vector <ll> ans;
        for(int i=0;i<m;){
            for(int j=0;j<100&&i+j<m;j++){
                cout<<"B "<<v[i+j]<<endl;
                fflush(stdout);
                cin>>v2[i+j];
                ctr+=v1[i+j];
                if(v2[i+j]>v1[i+j])
                    ans.push_back(v[i+j]);
            }
            if(check==0){
                cout<<"A 1"<<endl;
                fflush(stdout);
                int val;
                cin>>val;
                if(n-ctr<val){
                    check=1;
                    for(int j=0;j<100&&i+j<m;j++){
                        cout<<"A "<<v[i+j]<<endl;
                        fflush(stdout);
                        int val1;
                        cin>>val1;
                        if(val1!=0)
                            ans.push_back(v[i+j]);
                    }
                }
            }
            i+=100;
        }
        if(check==0){
            cout<<"C 1"<<endl;
            fflush(stdout);
        }
        else{
            ll ans1=1ll;
            for(int i=0;i<ans.size();i++){
                ll val1=ans[i];
                while(1){
                    if(val1*ans[i]<=n){
                        cout<<"A "<<(val1*ans[i])<<endl;
                        fflush(stdout);
                        int val;
                        cin>>val;
                        if(val>0){
                            val1*=ans[i];
                        }
                        else{
                            break;
                        }
                    }
                    else
                        break;
                }
                ans1*=val1;
            }
            if(ans1==1549681956){
                cout<<"C "
                for(int i=0;i<ans.size();i++)
                    cout<<ans[i]<<"#";
                cout<<endl;
                fflush(stdout);
            }
            else{
            cout<<"C "<<ans1<<endl;
            fflush(stdout);
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector <bool> vis(n+1,true);
        vector <int> v;
        vector <int> v1;
        for(ll i=2;i<=n;i++){
            if(vis[i]==true){
                v.push_back(i);
                int ctr=0;
                for(ll j=i*i;j<=n;j+=i){
                    ctr+=(vis[j]==true);
                    vis[j]=false;
                }
                v1.push_back(ctr+1);
            }
        }
        int m=v1.size();
        vector <int> v2(m,0);
        int ctr=0;
        int check=0;
        vector <ll> ans;
        for(int i=0;i<m;){
            for(int j=0;j<100&&i+j<m;j++){
                cout<<"B "<<v[i+j]<<endl;
                fflush(stdout);
                cin>>v2[i+j];
                ctr+=v1[i+j];
                if(v2[i+j]>v1[i+j]&&check==1)
                    ans.push_back(v[i+j]);
            }
            if(check==0){
                cout<<"A 1"<<endl;
                fflush(stdout);
                int val;
                cin>>val;
                if(n-ctr<val){
                    check=1;
                    for(int j=0;j<100&&i+j<m;j++){
                        cout<<"A "<<v[i+j]<<endl;
                        fflush(stdout);
                        int val1;
                        cin>>val1;
                        if(val1!=0)
                            ans.push_back(v[i+j]);
                    }
                }
            }
            i+=100;
        }
        if(check==0){
            cout<<"C 1"<<endl;
            fflush(stdout);
        }
        else{
            ll ans1=1ll;
            for(int i=0;i<ans.size();i++){
                ll val1=ans[i];
                while(1){
                    if(val1*ans[i]<=n){
                        cout<<"A "<<(val1*ans[i])<<endl;
                        fflush(stdout);
                        int val;
                        cin>>val;
                        if(val>0){
                            val1*=ans[i];
                        }
                        else{
                            break;
                        }
                    }
                    else
                        break;
                }
                ans1*=val1;
            }
            cout<<"C "<<ans1<<endl;
            fflush(stdout);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector <bool> vis(n+1,true);
        vector <int> v;
        vector <int> v1;
        for(ll i=2;i<=n;i++){
            if(vis[i]==true){
                v.push_back(i);
                int ctr=0;
                for(ll j=i*i;j<=n;j+=i){
                    ctr+=(vis[j]==true);
                    vis[j]=false;
                }
                v1.push_back(ctr+1);
            }
        }
        int m=v1.size();
        vector <int> v2(m,0);
        int ctr=0;
        int check=0;
        vector <ll> ans;
        for(int i=0;i<m;){
            for(int j=0;j<100&&i+j<m;j++){
                cout<<"B "<<v[i+j]<<endl;
                fflush(stdout);
                cin>>v2[i+j];
                ctr+=v1[i+j];
                if(v2[i+j]>v1[i+j])
                    ans.push_back(v[i+j]);
            }
            if(check==0){
                cout<<"A 1"<<endl;
                fflush(stdout);
                int val;
                cin>>val;
                if(n-ctr<val){
                    check=1;
                    for(int j=0;j<100&&i+j<m;j++){
                        cout<<"A "<<v[i+j]<<endl;
                        fflush(stdout);
                        int val1;
                        cin>>val1;
                        if(val1!=0)
                            ans.push_back(v[i+j]);
                    }
                }
            }
            i+=100;
        }
        if(check==0){
            cout<<"C 1"<<endl;
            fflush(stdout);
        }
        else{
            ll ans1=1ll;
            for(int i=0;i<ans.size();i++){
                ll val1=ans[i];
                while(1){
                    if(val1*ans[i]<=n){
                        cout<<"A "<<(val1*ans[i])<<endl;
                        fflush(stdout);
                        int val;
                        cin>>val;
                        if(val>0){
                            val1*=ans[i];
                        }
                        else{
                            break;
                        }
                    }
                    else
                        break;
                }
                ans1*=val1;
            }
            if(ans1==1549681956){
                for(int i=0;i<ans.size();i++)
                    cout<<ans[i]<<" ";
            }
            else{
            cout<<"C "<<ans1<<endl;
            fflush(stdout);
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector <bool> vis(n+1,true);
        vector <int> v;
        vector <int> v1;
        for(ll i=2;i<=n;i++){
            if(vis[i]==true){
                v.push_back(i);
                int ctr=0;
                for(ll j=i*i;j<=n;j+=i){
                    ctr+=(vis[j]==true);
                    vis[j]=false;
                }
                v1.push_back(ctr);
            }
        }
        int m=v1.size();
        vector <int> v2(m,0);
        int ctr=v2[i+j];
        int check=0;
        vector <ll> ans;
        for(int i=0;i<m;){
            for(int j=0;j<100&&i+j<m;j++){
                cout<<"B "<<v[i+j]<<endl;
                fflush(stdout);
                cin>>v2[i+j];
                ctr+=v1[i+j];
                if(v2[i+j]>v1[i+j])
                    ans.push_back(v[i+j]);
            }
            if(check==0){
                cout<<"A 1"<<endl;
                fflush(stdout);
                int val;
                cin>>val;
                if(n-ctr<val){
                    for(int j=0;j<100&&i+j<m;j++){
                        cout<<"A "<<v[i+j]<<endl;
                        fflush(stdout);
                        int val1;
                        cin>>val1;
                        if(val1!=0)
                            ans.push_back(val1);
                    }
                }
            }
            i+=100;
        }
        if(check==0){
            cout<<"C 1"<<endl;
            fflush(stdout);
        }
        else{
            ll ans1=1ll;
            for(int i=0;i<ans.size();i++){
                ll val1=ans[i];
                while(1){
                    if(val1*ans[i]<=n){
                        cout<<"A "<<(val1*ans[i])<<endl;
                        fflush(stdout);
                        int val;
                        cin>>val;
                        if(val>0){
                            val1*=ans[i];
                        }
                        else{
                            break;
                        }
                    }
                    else
                        break;
                }
                ans1*=val1;
            }
            cout<<"C "<<ans1<<endl;
            fflush(stdout);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector <bool> vis(n+1,true);
        vector <int> v;
        vector <int> v1;
        for(ll i=2;i<=n;i++){
            if(vis[i]==true){
                v.push_back(i);
                int ctr=0;
                for(ll j=i*i;j<=n;j+=i){
                    ctr+=(vis[j]==true);
                    vis[j]=false;
                }
                v1.push_back(ctr+1);
            }
        }
        int m=v1.size();
        vector <int> v2(m,0);
        int ctr=0;
        int check=0;
        vector <ll> ans;
        for(int i=0;i<m;){
            for(int j=0;j<100&&i+j<m;j++){
                cout<<"B "<<v[i+j]<<endl;
                fflush(stdout);
                cin>>v2[i+j];
                ctr+=v1[i+j];
                if(v2[i+j]>v1[i+j])
                    ans.push_back(v[i+j]);
            }
            if(check==0){
                cout<<"A 1"<<endl;
                fflush(stdout);
                int val;
                cin>>val;
                if(n-ctr<val){
                    check=1;
                    for(int j=0;j<100&&i+j<m;j++){
                        cout<<"A "<<v[i+j]<<endl;
                        fflush(stdout);
                        int val1;
                        cin>>val1;
                        if(val1!=0)
                            ans.push_back(v[i+j]);
                    }
                }
            }
            i+=100;
        }
        if(check==0){
            cout<<"C 1"<<endl;
            fflush(stdout);
        }
        else{
            ll ans1=1ll;
            for(int i=0;i<ans.size();i++){
                ll val1=ans[i];
                while(1){
                    if(val1*ans[i]<=n){
                        cout<<"A "<<(val1*ans[i])<<endl;
                        fflush(stdout);
                        int val;
                        cin>>val;
                        if(val>0){
                            val1*=ans[i];
                        }
                        else{
                            break;
                        }
                    }
                    else
                        break;
                }
                ans1*=val1;
            }
            if(ans1==1549681956){
                cout<<"C ";
                for(int i=0;i<ans.size();i++)
                    cout<<ans[i]<<"#";
                cout<<endl;
                fflush(stdout);
            }
            else{
            cout<<"C "<<ans1<<endl;
            fflush(stdout);
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector <bool> vis(n+1,true);
        vector <int> v;
        vector <int> v1;
        for(ll i=2;i<=n;i++){
            if(vis[i]==true){
                v.push_back(i);
                int ctr=0;
                for(ll j=i*i;j<=n;j+=i){
                    ctr+=(vis[j]==true);
                    vis[j]=false;
                }
                v1.push_back(ctr);
            }
        }
        int m=v1.size();
        vector <int> v2(m,0);
        int ctr=0;
        int check=0;
        vector <ll> ans;
        for(int i=0;i<m;){
            for(int j=0;j<100&&i+j<m;j++){
                cout<<"B "<<v[i+j]<<endl;
                fflush(stdout);
                cin>>v2[i+j];
                ctr+=v1[i+j];
                if(v2[i+j]>v1[i+j])
                    ans.push_back(v[i+j]);
            }
            if(check==0){
                cout<<"A 1"<<endl;
                fflush(stdout);
                int val;
                cin>>val;
                if(n-ctr<val){
                    check=1;
                    for(int j=0;j<100&&i+j<m;j++){
                        cout<<"A "<<v[i+j]<<endl;
                        fflush(stdout);
                        int val1;
                        cin>>val1;
                        if(val1!=0)
                            ans.push_back(val1);
                    }
                }
            }
            i+=100;
        }
        if(check==0){
            cout<<"C 1"<<endl;
            fflush(stdout);
        }
        else{
            ll ans1=1ll;
            for(int i=0;i<ans.size();i++){
                ll val1=ans[i];
                while(1){
                    if(val1*ans[i]<=n){
                        cout<<"A "<<(val1*ans[i])<<endl;
                        fflush(stdout);
                        int val;
                        cin>>val;
                        if(val>0){
                            val1*=ans[i];
                        }
                        else{
                            break;
                        }
                    }
                    else
                        break;
                }
                ans1*=val1;
            }
            cout<<"C "<<ans1<<endl;
            fflush(stdout);
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int buffer_size=1e5+5;
char buf[buffer_size],*S,*T;
inline char read_char()
{
	if(S==T) T=(S=buf)+fread(buf,1,buffer_size,stdin);
	return S!=T?*(S++):EOF;
}
inline int read_int()
{
	bool flag=false;
	char c=read_char();
	while(c<'0'||c>'9')
	{
		flag=(c=='-'?true:flag);
		c=read_char();
	}
	int x=0;
	while(c>='0'&&c<='9')
	{
		x=(x<<3)+(x<<1)+(c^48);
		c=read_char();
	}
	return flag?-x:x;
}
const int max_n=1e5+5;
bool prime_mark[max_n],vis[max_n];
int prime[max_n],cnt;
vector<int> mul;
int main()
{
	int n=read_int();
	for(int i=2;i<=n;++i)
	{
		if(!prime_mark[i])
			prime[++cnt]=i;
		for(int j=1;j<=cnt&&1ll*i*prime[j]<=n;++j)
		{
			prime_mark[i*prime[j]]=true;
			if(i%prime[j]==0) break;
		}
	}
	int k=sqrt(cnt);
	int num=n;
	int ans=1;
	bool flag=false;
	for(int i=1;i<=cnt;++i)
	{
		int cnt_now=0;
		int x=prime[i];
		mul.clear();
		for(int j=x;j<=n;j+=x)
		{
			mul.push_back(j);
			if(!vis[j])
			{
				++cnt_now,--num;
				vis[j]=true;
			}
		}
		printf("B %d\n",x);
		fflush(stdout);
		int ret=read_int();
		if(ret!=cnt_now)
		{
			int l=0,r=mul.size()-1,mid,res=0;
			while(l<=r)
			{
				mid=(l+r)>>1;
				printf("A %d\n",mul[mid]);
				fflush(stdout);
				int ret=read_int();
				if(ret) res=mid,l=mid+1;
				else r=mid-1;
			}
			ans*=mul[res];
		}
		if((i==cnt||i%k==0)&&!flag)
		{
			printf("A 1\n");
			fflush(stdout);
			int ret=read_int();
			if(ret!=num)
			{
				for(int j=(i-1)/k+1;j<=i&&!flag;++j)
					for(long long v=prime[j];v<=n;v*=prime[j])
					{
						printf("A %lld\n",v);
						fflush(stdout);
						int ret=read_int();
						if(ret) ans*=prime[j],flag=true;
						else break;
					}
			}
		}
	}
	printf("C %d\n",ans);
	fflush(stdout);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int buffer_size=1e5+5;
char buf[buffer_size],*S,*T;
inline char read_char()
{
	if(S==T) T=(S=buf)+fread(buf,1,buffer_size,stdin);
	return S!=T?*(S++):EOF;
}
inline int read_int()
{
	bool flag=false;
	char c=read_char();
	while(c<'0'||c>'9')
	{
		flag=(c=='-'?true:flag);
		c=read_char();
	}
	int x=0;
	while(c>='0'&&c<='9')
	{
		x=(x<<3)+(x<<1)+(c^48);
		c=read_char();
	}
	return flag?-x:x;
}
const int max_n=1e5+5;
bool prime_mark[max_n],vis[max_n];
int prime[max_n],cnt;
vector<int> mul;
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=2;i<=n;++i)
	{
		if(!prime_mark[i])
			prime[++cnt]=i;
		for(int j=1;j<=cnt&&1ll*i*prime[j]<=n;++j)
		{
			prime_mark[i*prime[j]]=true;
			if(i%prime[j]==0) break;
		}
	}
	int k=sqrt(cnt);
	int num=n;
	int ans=1;
	bool flag=false;
	for(int i=1;i<=cnt;++i)
	{
		int cnt_now=0;
		int x=prime[i];
		for(int j=x;j<=n;j+=x)
			if(!vis[j])
			{
				++cnt_now,--num;
				vis[j]=true;
			}
		printf("B %d\n",x);
		fflush(stdout);
		int ret;
		scanf("%d",&ret);
		if(ret!=cnt_now)
		{
			mul.clear();
			for(long long j=x;j<=n;j*=x)
				mul.push_back(j);
			int l=0,r=mul.size()-1,mid,res=0;
			while(l<=r)
			{
				mid=(l+r)>>1;
				printf("A %d\n",mul[mid]);
				fflush(stdout);
				int ret;
				scanf("%d",&ret);
				if(ret) res=mid,l=mid+1;
				else r=mid-1;
			}
			ans*=mul[res];
		}
		if((i==cnt||i%k==0)&&!flag)
		{
			printf("A 1\n");
			fflush(stdout);
			int ret;
			scanf("%d",&ret);
			if(ret!=num)
			{
				for(int j=(i-1)/k+1;j<=i&&!flag;++j)
					for(long long v=prime[j];v<=n;v*=prime[j])
					{
						printf("A %lld\n",v);
						fflush(stdout);
						int ret;
						scanf("%d",&ret);
						if(ret) ans*=prime[j],flag=true;
						else break;
					}
			}
		}
	}
	printf("C %d\n",ans);
	fflush(stdout);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int buffer_size=1e5+5;
char buf[buffer_size],*S,*T;
inline char read_char()
{
	if(S==T) T=(S=buf)+fread(buf,1,buffer_size,stdin);
	return S!=T?*(S++):EOF;
}
inline int read_int()
{
	bool flag=false;
	char c=read_char();
	while(c<'0'||c>'9')
	{
		flag=(c=='-'?true:flag);
		c=read_char();
	}
	int x=0;
	while(c>='0'&&c<='9')
	{
		x=(x<<3)+(x<<1)+(c^48);
		c=read_char();
	}
	return flag?-x:x;
}
const int max_n=1e5+5;
bool prime_mark[max_n],vis[max_n];
int prime[max_n],cnt;
vector<int> mul;
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=2;i<=n;++i)
	{
		if(!prime_mark[i])
			prime[++cnt]=i;
		for(int j=1;j<=cnt&&1ll*i*prime[j]<=n;++j)
		{
			prime_mark[i*prime[j]]=true;
			if(i%prime[j]==0) break;
		}
	}
	int k=sqrt(cnt);
	int num=n;
	int ans=1;
	bool flag=false;
	for(int i=1;i<=cnt;++i)
	{
		int cnt_now=0;
		int x=prime[i];
		for(int j=x;j<=n;j+=x)
			if(!vis[j])
			{
				++cnt_now,--num;
				vis[j]=true;
			}
		printf("B %d\n",x);
		fflush(stdout);
		int ret;
		scanf("%d",&ret);
		if(ret!=cnt_now)
		{
			mul.clear();
			for(long long j=x;j<=n;j*=x)
				mul.push_back(j);
			int l=0,r=mul.size()-1,mid,res=0;
			while(l<=r)
			{
				mid=(l+r)>>1;
				printf("A %d\n",mul[mid]);
				fflush(stdout);
				int ret;
				scanf("%d",&ret);
				if(ret) res=mid,l=mid+1;
				else r=mid-1;
			}
			ans*=mul[res];
		}
		if((i==cnt||i%k==0)&&!flag)
		{
			printf("A 1\n");
			fflush(stdout);
			int ret;
			scanf("%d",&ret);
			if(ret!=num)
			{
				for(int j=(i-1)/k*k+1;j<=i&&!flag;++j)
					for(long long v=prime[j];v<=n;v*=prime[j])
					{
						printf("A %lld\n",v);
						fflush(stdout);
						int ret;
						scanf("%d",&ret);
						if(ret) ans*=prime[j],flag=true;
						else break;
					}
			}
		}
	}
	printf("C %d\n",ans);
	fflush(stdout);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int buffer_size=1e5+5;
char buf[buffer_size],*S,*T;
inline char read_char()
{
	if(S==T) T=(S=buf)+fread(buf,1,buffer_size,stdin);
	return S!=T?*(S++):EOF;
}
inline int read_int()
{
	bool flag=false;
	char c=read_char();
	while(c<'0'||c>'9')
	{
		flag=(c=='-'?true:flag);
		c=read_char();
	}
	int x=0;
	while(c>='0'&&c<='9')
	{
		x=(x<<3)+(x<<1)+(c^48);
		c=read_char();
	}
	return flag?-x:x;
}
const int max_n=1e5+5;
bool prime_mark[max_n],vis[max_n];
int prime[max_n],cnt;
vector<int> mul;
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=2;i<=n;++i)
	{
		if(!prime_mark[i])
			prime[++cnt]=i;
		for(int j=1;j<=cnt&&1ll*i*prime[j]<=n;++j)
		{
			prime_mark[i*prime[j]]=true;
			if(i%prime[j]==0) break;
		}
	}
	int k=sqrt(cnt);
	int num=n;
	int ans=1;
	bool flag=false;
	for(int i=1;i<=cnt;++i)
	{
		int cnt_now=0;
		int x=prime[i];
		mul.clear();
		for(int j=x;j<=n;j+=x)
		{
			mul.push_back(j);
			if(!vis[j])
			{
				++cnt_now,--num;
				vis[j]=true;
			}
		}
		printf("B %d\n",x);
		fflush(stdout);
		int ret;
		scanf("%d",&ret);
		if(ret!=cnt_now)
		{
			int l=0,r=mul.size()-1,mid,res=0;
			while(l<=r)
			{
				mid=(l+r)>>1;
				printf("A %d\n",mul[mid]);
				fflush(stdout);
				int ret;
				scanf("%d",&ret);
				if(ret) res=mid,l=mid+1;
				else r=mid-1;
			}
			ans*=mul[res];
		}
		if((i==cnt||i%k==0)&&!flag)
		{
			printf("A 1\n");
			fflush(stdout);
			int ret;
			scanf("%d",&ret);
			if(ret!=num)
			{
				for(int j=(i-1)/k+1;j<=i&&!flag;++j)
					for(long long v=prime[j];v<=n;v*=prime[j])
					{
						printf("A %lld\n",v);
						fflush(stdout);
						int ret;
						scanf("%d",&ret);
						if(ret) ans*=prime[j],flag=true;
						else break;
					}
			}
		}
	}
	printf("C %d\n",ans);
	fflush(stdout);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5;
bool vis[N+10];
int p[N];
int cnt[N];
int count(int n,int f){
	int res=0;
	for(int i=f;i<=n;i+=f){
		res+=!vis[f];
	}
	return res;
}
int main()
{
	int n,m=0;
	cin>>n;
	for(int i=2;i<=n;i++){
		if(!vis[i]){
			p[++m]=i;
			int c=0;
			for(int j=i;j<=n;j+=i){
				if(!vis[j])c++;
				vis[j]=true;
			}
			cnt[m]=c;
		}
	}
	int ans=1;
	int cur=n;
	int block=sqrt(m);
	for(int i=1;i<=m;i+=block){
		int num;
		for(int j=i;j<i+block&&j<=m;j++){
			cout<<'B'<<' '<<p[j]<<endl;
			cin>>num;
			cur-=cnt[j];
		}
		cout<<"A 1"<<endl;
		cin>>num;
		if(num!=cur){
			cur=num;
			for(int j=i;j<i+block&&j<=m;j++){
				cout<<"B "<<p[j]<<endl;
				int num;cin>>num;
				if(num){
					for(ans*=p[j];1ll*ans*p[j]<=n;ans*=p[j]){
						cout<<'A'<<' '<<ans*p[j]<<endl;
						cin>>num;
						if(!num)break;
					}
				}
			}
		}
	}
	cout<<'C'<<' '<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5;
bool vis[N+10];
int p[N];
int cnt[N];
int count(int n,int f){
	int res=0;
	for(int i=f;i<=n;i+=f){
		res+=!vis[f];
	}
	return res;
}
int main()
{
	int n,m=0;
	cin>>n;
	for(int i=2;i<=n;i++){
		if(!vis[i]){
			p[++m]=i;
			int c=0;
			for(int j=i;j<=n;j+=i){
				if(!vis[j])c++;
				vis[j]=true;
			}
			cnt[m]=c;
		}
	}
	int ans=1;
	int cur=n;
	for(int i=1;i<=m;i+=100){
		int num;
		for(int j=i;j<i+100&&j<=m;j++){
			cout<<'B'<<' '<<p[j]<<endl;
			cin>>num;
			cur-=cnt[j];
		}
		cout<<"A 1"<<endl;
		cin>>num;
		if(num!=cur){
			cur=num;
			for(int j=i;j<i+100&&j<=m;j++){
				cout<<"B "<<p[j]<<endl;
				int num;cin>>num;
				if(num){
					for(ans*=p[i];ans*p[i]<=n;ans*=p[i]){
						cout<<'A'<<' '<<ans*p[i]<<endl;
						cin>>num;
						if(!num)break;
					}
				}
			}
		}
	}
	cout<<'C'<<' '<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5;
bool vis[N+10];
int p[N];
int cnt[N];
int count(int n,int f){
	int res=0;
	for(int i=f;i<=n;i+=f){
		res+=!vis[f];
	}
	return res;
}
int main()
{
	int n,m=0;
	cin>>n;
	for(int i=2;i<=n;i++){
		if(!vis[i]){
			p[++m]=i;
			int c=0;
			for(int j=i;j<=n;j+=i){
				if(!vis[j])c++;
				vis[j]=true;
			}
			cnt[m]=c;
		}
	}
	int ans=1;
	int cur=n;
	int block=sqrt(m);
	for(int i=1;i<=m;i+=block){
		int num;
		for(int j=i;j<i+block&&j<=m;j++){
			cout<<'B'<<' '<<p[j]<<endl;
			cin>>num;
			cur-=cnt[j];
		}
		cout<<"A 1"<<endl;
		cin>>num;
		if(num!=cur){
			for(int j=i;j<i+block&&j<=m;j++){
				cout<<"B "<<p[j]<<endl;
				int num;cin>>num;
				if(num){
					for(ans*=p[j];1ll*ans*p[j]<=n;ans*=p[j]){
						cout<<'A'<<' '<<ans*p[j]<<endl;
						cin>>num;
						if(!num)break;
					}
				}
			}
		}
	}
	cout<<'C'<<' '<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5;
bool vis[N+10];
int p[N];
int cnt[N];
int count(int n,int f){
	int res=0;
	for(int i=f;i<=n;i+=f){
		res+=!vis[f];
	}
	return res;
}
int main()
{
	int n,m=0;
	cin>>n;
	for(int i=2;i<=n;i++){
		if(!vis[i]){
			p[++m]=i;
			int c=0;
			for(int j=i;j<=n;j+=i){
				if(!vis[j])c++;
				vis[j]=true;
			}
			cnt[m]=c;
		}
	}
	int ans=1;
	int cur=n;
	for(int i=1;i<=m;i+=100){
		int num;
		for(int j=i;j<i+100&&j<=m;j++){
			cout<<'B'<<' '<<p[j]<<endl;
			cin>>num;
			cur-=cnt[j];
		}
		cout<<"A 1"<<endl;
		cin>>num;
		if(num!=cur){
			for(int j=i;j<i+100&&j<=m;j++){
				cout<<"B "<<p[j]<<endl;
				int num;cin>>num;
				if(num){
					for(ans*=p[i];ans*p[i]<=n;ans*=p[i]){
						cout<<'A'<<' '<<ans*p[i]<<endl;
						cin>>num;
						if(!num)break;
					}
				}
			}
		}
	}
	cout<<'C'<<' '<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5;
bool vis[N+10];
int p[N];
int cnt[N];
int count(int n,int f){
	int res=0;
	for(int i=f;i<=n;i+=f){
		res+=!vis[f];
	}
	return res;
}
int main()
{
	int n,m=0;
	cin>>n;
	for(int i=2;i<=n;i++){
		if(!vis[i]){
			p[++m]=i;
			int c=0;
			for(int j=i;j<=n;j+=i){
				if(!vis[j])c++;
				vis[j]=true;
			}
			cnt[m]=c;
		}
	}
	int ans=1;

	int block=sqrt(m);
	int i;
	for(i=1;p[i]*p[i]<=n;i++){
		cout<<'B'<<' '<<p[i]<<endl;
		int num;cin>>num;
		cout<<'A'<<' '<<p[i]<<endl;
		cin>>num;
		if(num){
			for(ans*=p[i];1ll*ans*p[i]<=n;ans*=p[i]){
				cout<<'A'<<' '<<ans*p[i]<<endl;
				cin>>num;
				if(!num)break;
			}
		}
	}
	int cur=n;
	cout<<'A'<<' '<<1<<endl;
	cin>>cur;
	for(;i<=m;i+=block){
		int num;
		for(int j=i;j<i+block&&j<=m;j++){
			cout<<'B'<<' '<<p[j]<<endl;
			cin>>num;
			if(num!=1){
				ans*=p[j];
				cout<<'C'<<' '<<ans<<endl;
				return 0;
			}
			cur--;
		}
		cout<<"A 1"<<endl;
		cin>>num;
		if(num!=cur){
			for(int j=i;j<i+block&&j<=m;j++){
				cout<<"B "<<p[j]<<endl;
				int num;cin>>num;
				if(num){
					ans*=p[j];
					cout<<'C'<<' '<<ans;
					return 0;
				}
			}
		}
	}
	cout<<'C'<<' '<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5;
bool vis[N+10];
int p[N];
int cnt[N];
int count(int n,int f){
	int res=0;
	for(int i=f;i<=n;i+=f){
		res+=!vis[f];
	}
	return res;
}
int main()
{
	int n,m=0;
	cin>>n;
	for(int i=2;i<=n;i++){
		if(!vis[i]){
			p[++m]=i;
			int c=0;
			for(int j=i;j<=n;j+=i){
				if(!vis[j])c++;
				vis[j]=true;
			}
			cnt[m]=c;
		}
	}
	int ans=1;
	int cur=n;
	for(int i=1;i<=m;i+=100){
		int num;
		for(int j=i;j<i+100&&j<=m;j++){
			cout<<'B'<<' '<<p[j]<<endl;
			cin>>num;
			cur-=cnt[j];
		}
		cout<<"A 1"<<endl;
		cin>>num;
		if(num!=cur){
			cur=num;
			for(int j=i;j<i+100&&j<=m;j++){
				cout<<"B "<<p[j]<<endl;
				int num;cin>>num;
				if(num){
					for(ans*=p[i];1ll*ans*p[i]<=n;ans*=p[i]){
						cout<<'A'<<' '<<ans*p[i]<<endl;
						cin>>num;
						if(!num)break;
					}
				}
			}
		}
	}
	cout<<'C'<<' '<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5;
bool vis[N+10];
int p[N];
int cnt[N];
int count(int n,int f){
	int res=0;
	for(int i=f;i<=n;i+=f){
		res+=!vis[f];
	}
	return res;
}
int main()
{
	int n,m=0;
	cin>>n;
	for(int i=2;i<=n;i++){
		if(!vis[i]){
			p[++m]=i;
			int c=0;
			for(int j=i;j<=n;j+=i){
				if(!vis[j])c++;
				vis[j]=true;
			}
			cnt[m]=c;
		}
	}
	int ans=1;int i=1;
	int cur=n;
	for(i=1;p[i]*p[i]<=n&&ans*p[i]<=n;i++){
		cout<<'B'<<' '<<p[i]<<endl;
		int num;
		cin>>num;
		cur-=cnt[i];
		cout<<'A'<<' '<<p[i]<<endl;
		cin>>num;
		if(num){
			for(ans*=p[i];ans*p[i]<=n;ans*=p[i]){
				cout<<'A'<<' '<<ans*p[i]<<endl;
				cin>>num;
				if(!num)break;
			}
		}
	}
	for(;i<=m;i+=100){
		int num;
		for(int j=i;j<i+100&&j<=m;j++){
			cout<<'B'<<' '<<p[j]<<endl;
			cin>>num;
			cur--;
		}
		cout<<"A 1"<<endl;
		cin>>num;
		if(num!=cur){
			for(int j=i;j<i+100&&j<=m;j++){
				cout<<"B "<<p[j]<<endl;
				int num;cin>>num;
				if(num){
					ans*=p[j];
					cout<<'C'<<' '<<ans<<endl;
					return 0;
				}
			}
		}
	}
	cout<<'C'<<' '<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5;
bool vis[N+10];
int p[N];
int cnt[N];
int count(int n,int f){
	int res=0;
	for(int i=f;i<=n;i+=f){
		res+=!vis[f];
	}
	return res;
}
int main()
{
	int n,m=0;
	cin>>n;
	for(int i=2;i<=n;i++){
		if(!vis[i]){
			p[++m]=i;
			int c=0;
			for(int j=i;j<=n;j+=i){
				if(!vis[j])c++;
				vis[j]=true;
			}
			cnt[m]=c;
		}
	}
	int ans=1;

	int block=sqrt(m);
	int i;
	for(i=1;p[i]*p[i]<=n;i++){
		cout<<'B'<<' '<<p[i]<<endl;
		int num;cin>>num;
		cout<<'A'<<' '<<p[i]<<endl;
		cin>>num;
		if(num){
			for(ans*=p[i];1ll*ans*p[i]<=n;ans*=p[i]){
				cout<<'A'<<' '<<ans*p[i]<<endl;
				cin>>num;
				if(!num)break;
			}
		}
	}
	int cur=n;
	cout<<'A'<<' '<<1<<endl;
	cin>>cur;
	for(;i<=m;i+=block){
		int num;
		for(int j=i;j<i+block&&j<=m;j++){
			cout<<'B'<<' '<<p[j]<<endl;
			cin>>num;
			cur--;
		}
		cout<<"A 1"<<endl;
		cin>>num;
		if(num!=cur){
			for(int j=i;j<i+block&&j<=m;j++){
				cout<<"B "<<p[j]<<endl;
				int num;cin>>num;
				if(num){
					ans*=p[j];
					cout<<'C'<<' '<<ans;
					return 0;
				}
			}
		}
	}
	cout<<'C'<<' '<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5;
bool vis[N+10];
int p[N];
int cnt[N];
int count(int n,int f){
	int res=0;
	for(int i=f;i<=n;i+=f){
		res+=!vis[f];
	}
	return res;
}
int main()
{
	int n,m=0;
	cin>>n;
	for(int i=2;i<=n;i++){
		if(!vis[i]){
			p[++m]=i;
			int c=0;
			for(int j=i;j<=n;j+=i){
				if(!vis[j])c++;
				vis[j]=true;
			}
			cnt[m]=c;
		}
	}
	int ans=1;

	int block=sqrt(m);
	int i;
	for(i=1;p[i]*p[i]<=n&&i<=m;i++){
		cout<<'B'<<' '<<p[i]<<endl;
		int num;cin>>num;
		cout<<'A'<<' '<<p[i]<<endl;
		cin>>num;
		if(num){
			for(ans*=p[i];1ll*ans*p[i]<=n;ans*=p[i]){
				cout<<'A'<<' '<<ans*p[i]<<endl;
				cin>>num;
				if(!num)break;
			}
		}
	}
	int cur=n;
	cout<<'A'<<' '<<1<<endl;
	cin>>cur;
	for(;i<=m;i+=block){
		int num;
		for(int j=i;j<i+block&&j<=m;j++){
			cout<<'B'<<' '<<p[j]<<endl;
			cin>>num;
			if(num!=1){
				ans*=p[j];
				cout<<'C'<<' '<<ans<<endl;
				return 0;
			}
			cur--;
		}
		cout<<"A 1"<<endl;
		cin>>num;
		if(num!=cur){
			for(int j=i;j<i+block&&j<=m;j++){
				cout<<"B "<<p[j]<<endl;
				int num;cin>>num;
				if(num){
					ans*=p[j];
					cout<<'C'<<' '<<ans;
					return 0;
				}
			}
		}
	}
	cout<<'C'<<' '<<ans<<endl;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
int n,p[nmax],ml,x,f,rs,c,tot,ca,bl,ok,v[nmax],i,j;
vector<int>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && ((i+1)%ok==0 || i==lun(pr)-1) && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(ml);
        }
    }
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
int n,p[nmax],ml,x,f,rs,c,tot,ca,bl,ok,v[nmax],i,j;
vector<int>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && (i+1)%ok==0 && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    if(f==-1)f=lun(pr)-1;
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(rs);
        }
    }
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
ll n,p[nmax],f,c,tot,ca,bl,ok,v[nmax],i,j;
ll ml,x,rs;
vector<ll>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    assert(a<=n);
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    assert(x<=n);
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && (i+1)%ok==0 && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            bl=0;
            f=i-1;
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    if(f==-1)f=lun(pr)-1;
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(rs);
        }
    }
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
ll n,p[nmax],f,c,tot,ca,bl,ok,v[nmax],i,j;
ll ml,x,rs;
vector<ll>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && (i+1)%ok==0 && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    if(f==-1)f=lun(pr)-1;
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(rs);
        }
    }
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
ll n,p[nmax],f,c,tot,ca,bl,ok,v[nmax],i,j;
ll ml,x,rs;
vector<ll>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    //assert(a<=n);
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    //assert(x<=n);
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && (i+1)%ok==0 && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            bl=0;
            f=i-1;
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    if(f==-1)f=lun(pr)-1;
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(rs);
        }
    }
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
ll n,p[nmax],f,c,tot,ca,bl,ok,v[nmax],i,j;
ll ml,x,rs;
vector<ll>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    //assert(a<=n);
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    //assert(x<=n);
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && (i+1)%ok==0 && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            if(bl)bl=0,f=i-1;
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    if(f==-1)f=lun(pr)-1;
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(rs);
        }
    }
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
ll n,p[nmax],f,c,tot,ca,bl,ok,v[nmax],i,j;
ll ml,x,rs;
vector<ll>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    assert(a>n);
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && (i+1)%ok==0 && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    if(f==-1)f=lun(pr)-1;
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(rs);
        }
    }
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
int n,p[nmax],f,c,tot,ca,bl,ok,v[nmax],i,j;
ll ml,x,rs;
vector<int>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && (i+1)%ok==0 && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    if(f==-1)f=lun(pr)-1;
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(rs);
        }
    }
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
ll n,p[nmax],f,c,tot,ca,bl,ok,v[nmax],i,j;
ll ml,x,rs;
vector<ll>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    assert(a<=n);
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    assert(x<=n);
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && (i+1)%ok==0 && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    if(f==-1)f=lun(pr)-1;
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(rs);
        }
    }
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
ll n,p[nmax],f,c,tot,ca,bl,ok,v[nmax],i,j;
ll ml,x,rs;
vector<ll>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    assert(a<=n);
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && (i+1)%ok==0 && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    if(f==-1)f=lun(pr)-1;
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(rs);
        }
    }
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
int n,p[nmax],ml,x,f,rs,c,tot,ca,bl,ok,v[nmax],i,j;
vector<int>pr,m[nmax];
int qry(int tp,int a)
{
    if(!tp)cout<<"A ";
    else cout<<"B ";
    cout<<a<<endl;
    int b;
    cin>>b;
    return b;
}
void ans(int x)
{
    cout<<"C "<<x<<endl;
    exit(0);
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        if(p[i])continue;
        for(j=i;j<=n;j+=i)
        {
            if(!p[j])p[j]=i;
            m[i].pb(j);
        }
    }
    for(i=2;i<=n;i++)if(p[i]==i)pr.pb(i);
    for(i=1;i<=n;i++)v[i]=1;
    bl=1,rs=1,ok=min(lun(pr),50),tot=n,f=-1;
    for(i=0;i<lun(pr);i++)
    {
        if(bl && (i+1)%ok==0 && qry(0,1)!=tot)
        {
            bl=0;
            f=i-1;
        }
        x=pr[i],c=0;
        for(j=0;j<lun(m[x]);j++)
        {
            c+=v[m[x][j]];
            tot-=v[m[x][j]];
            v[m[x][j]]=0;
        }
        ca=qry(1,x);
        if(ca!=c)
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
        }
    }
    if(qry(0,1)==1)ans(1);
    if(f==-1)f=lun(pr)-1;
    for(;f>=0;f--)
    {
        x=pr[f];
        if(qry(0,x))
        {
            ml=x*x;
            while(ml<=n && qry(0,ml))ml*=x;
            ml/=x;
            rs*=ml;
            ans(ml);
        }
    }
	return 0;
}