#include<iostream>
#include <vector>
#include <cmath>
using namespace std;

bool arr[10000000];
int main()
{
    int n;
    cin >> n;

    int st = 3;
    int b = 8;
    int res = 0;
    int cnt = 0;


//    while(n > b)
//    {
//        b = b*2;
//        st++;
//    }
vector<int> resa;
int startx;
    for(int i = st; i<=32; i++)
    {

        int x = (1<<i);
        startx = x;
        arr[x] = 1;
        int cnt = 0;
//        int helper = 1;
//        //cout << i << "kosa" << endl;
//        //utility func
//        for(int k = 0; k<=i+1; k++)
//        {
//            int s = helper;
//            helper = (s | (1<<k));
//        }

        int predx = x;
        int lx = x;

        while(res < n )
        {
            int pr;
            pr = ((x>>1) ^ x);

            if(predx != pr)
            {
                if(!arr[pr])
                {
                    x = pr;
                    res++;
                    arr[x] = 1;
                    cnt++;
                    resa.push_back(2);
                    lx = x;
                    //cout << x << endl;
                }

            }
            else
            {
                    int tmp = lx^1; //cout << x  <<"!!!!"<< tmp << "!!!!!!!!!" << res << endl;

                    if(arr[tmp])
                    {
                        break;
                    }
                    else
                    {
                        cnt = 1;
                        x = tmp;
                        predx = x;
                        res++;
                        resa.push_back(1);
                        arr[x] = 1;
                        lx = x;
                    }

            }
        }
        if(res>=n)
        {
        cout << startx << endl;
            for(int f = i; f>=0; f--)
            {
                if((startx & (1<<i)) == 0)
                {
                    cout << "B";
                }
                else
                {
                    cout << "A";
                }
            }
            cout << endl;
            for(int p = 0; p<resa.size(); p++) cout << resa[p] << endl;
            break;
        }
        else
        {
            res = 0;
            cnt = 0;
            resa.clear();
            for(int c = 0; c < pow(2, i+3); c++) arr[c]  = 0;

        }


    }

    return 0;
}
