#include<iostream>
#include<fstream>
#include<vector>
#include<cstring>
using namespace std;

int n, nrb, dest;
bool ver[500010];int ee;

vector<int> rez;

bool df(int nod, int pas) {
    if(nod == dest && pas == n) {
        return 1;
    }
    if(ver[nod])
        return 0;
    ver[nod] = 1;
    
    int newn = (nod ^ (nod / 2));
    if(newn >= (1<<nrb))
        newn -= (1<<nrb);
    
    if(df(newn, pas + 1)) {
        rez.push_back(2);
        return 1;
    }
    
    if(df(nod ^ 1, pas + 1)) {
        rez.push_back(1);
        return 1;
    }
    
    
    ver[nod] = 0;
    return 0;
}

void df2(int nod) {
    if(!ver[nod])
        return;
    ver[nod] = 0;
    
    df2(nod ^ 1);
    
    int newn = (nod ^ (nod / 2));
    if(newn >= (1<<nrb))
        newn -= (1<<nrb);
    df2(newn);
}

bool verr(int nr) {
    int nrp = 0;
    nrb = 0;
    memset(ver, 0, sizeof(ver));
    ee = 0;
    dest = nr;
    rez.clear();
    
    while(nr >= (1<<nrb))
        ++nrb;

    if(df(nr, 0)) {
        int i;
        for(i = nrb - 1; i >= 0; --i) {
            if(nr & (1<<i))
                cout << "A";
            else
                cout << "B";
        }
        cout << "\n";
        
        for(i = rez.size() - 1; i >= 0; --i)
            cout << rez[i];
        
        cout << "\n";
        df2(nr);
        return 1;
    }
    return 0;
}

int main() {
    int i, j;
    //freopen("ttt", "r", stdin);
    
    cin >> n;
    
    if(n % 2 == 0) {
        for(i = 0; i <= n; ++i)
            if((1<<i) >= n)
                break;
        
        cout << "A";
        for(j = 1; j <= i; ++j)
            cout << "B";
        cout << "\n";
        
        int elc = 0, nr = ((1<<i) - n) / 2;
        
        for(j = 1; j <= n; ++j) {
            elc = j & 1;
            
            if(elc == 0 && nr) {
                --nr;
                elc = 1;
            }
            
            cout << elc + 1;
        }
        return 0;
    }
    else {
        cout << "NO";
        return 0;
    }
    
    int aa = 0;
    for(i = 1; i <= 10; ++i)
        if(verr(1<<i)) {
            aa = 1;
            break;
            aa = 1;
        }
    if(!aa)
        cout << "NO";
    
    return 0;
}
