#include<stdio.h>
#include<queue>
#include<string>
#include<string.h>
using namespace std;

const int LIM = 20;

int flag, n;
char str[LIM];

bool vis[1 << LIM];
queue <string> q;
string word;

bool testBit (int x, int bit) {
    return x & (1 << bit);
}

int code (string str) {
    int c, i;

    c = 0;
    for(i = 0; i < str.size(); ++ i)
        if(str[i] == 'B')
            c |= (1 << i);
    return c;
}

bool ok() {
    int op, i, j, cn, cw;
    string w, wn;

    cw = code(word);

    for(op = 0; op < (1 << n); ++ op) {
        w = word;
        memset(vis, 0, sizeof(vis));

        for(i = n - 1; i >= 0; --i) {
            if(testBit(op, i)) {
                wn = w;
                wn[0] = 'A';
                for(j = 1; j < w.size(); ++ j)
                    if(w[j] == w[j - 1])
                        wn[j] = 'B';
                    else
                        wn[j] = 'A';
            }
            else {
                wn = w;
                if(wn[wn.size() - 1] == 'A')
                    wn[wn.size() - 1] = 'B';
                else
                    wn[wn.size() - 1] = 'A';
            }

            cn = code(wn);
            if(!vis[cn])
                vis[cn] = 1;
            else
                break;
            w = wn;
        }

        if(i < 0 && cn == cw) {
            printf("%s\n", word.c_str());
            for(i = n - 1; i >= 0; -- i)
                if(testBit(op, i))
                    printf("2");
                else
                    printf("1");
            printf("\n");
            return 1;
        }
    }
    return 0;
}

int main() {
   // freopen("abwords.in", "r", stdin);
    //freopen("abwords.out", "w", stdout);
    int i;
    string w;

    scanf("%d", &n);
    if(n > LIM) {
        printf("NO\n");
        return 0;
    }
    q.push("A");
    while(!q.empty()) {
        word = q.front();
        q.pop();

        if(ok())
            return 0;

        w = word + 'A';
        q.push(w);

      //  w = word + 'B';
        //q.push(w);
    }
    printf("NO\n");
    return 0;
}
