#include <iostream>
#include <tr1/unordered_set>
#include <tr1/unordered_map>

using namespace std;

int n;

typedef unsigned int iint;

tr1::unordered_set<iint> viz;
tr1::unordered_map<iint, bool> choice;


int bits;

iint snd(const iint x)
{
    iint ret = 0;
    for(iint i = 1 ; i <= bits ; ++i) {
        bool good = bool(x & (1 << i)) == bool(x & (1 << (i - 1)));
        ret |= good << i;
    }
    return ret;
}

iint fst(iint x)
{
    x ^= 1LL << bits;
    return x;
}

bool DFS(const iint x, const int depth) {

    if(depth > n)
        return 0;

    if(depth == n)
        return x == 0;

    if(viz.count(x))
        return 0;

    viz.insert(x);

    bool ret = 0;

    if(DFS(fst(x), depth + 1)) {
        choice[x] = 0;
        ret = 1;
    }
    if(!ret && DFS(snd(x), depth + 1)) {
        choice[x] = 1;
        ret = 1;
    }

    viz.erase(x);
    return ret;
}

char t[2] = {'A', 'B'};

void bitwise()
{
    for(int i = 0 ; i <= bits ; ++i)
        cout << "A";
}

void operations(iint st)
{
    for(int i = 1 ; i <= n ; ++i) {
        cout << choice[st] + 1;
        if(choice[st] == 0)
            st = fst(st);
        else
            st = snd(st);
    }
}

int main()
{
    int sol = 0;
    bool found = 0;
    cin >> n;
    for(bits = 1 ; bits < 31 && !found ; ++bits) {

        if(DFS(0, 0)){
            found = 1;
            break;
        }

    }
    cerr << bits+1 << "\n";

    if(!found)
        cout << "NO\n";
    else {
        bitwise();
        cout << "\n";
        operations(sol);
    }

    return 0;
}
