#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

typedef long long int64;

int RequiredCycleLength;
/*vector< vector<int> > G;
int V;*/
int Length;
vector< pair<int64, int> > Cycle;

inline int GetBit(const int64 mask, const int bit) {
    return (mask >> bit) & 1;
}
/*
void BuildGraph(const int n) {
    V = 1 << (n - 1);
    G = vector< vector<int> >(V, vector<int>());
    for (int x = 0; x < V; ++x) {
        G[x].push_back(x ^ 1);
        int y = 0;
        for (int i = 0; i + 1 < n; ++i)
            if (GetBit(x, i + 1) == GetBit(x, i))
                y ^= (1 << i);
        G[x].push_back(y);
    }
}
*/
inline void PrintBinary(const int64 mask, const int bits) {
    for (int i = bits - 1; i >= 0; --i)
        printf("%c", char('A' + GetBit(mask, i)));
}
/*
void Back(const int x, vector< pair<int, int> > &stack, vector<bool> &visited) {
    if (x == stack[0].first) {
        if (int(stack.size()) == RequiredCycleLength)
            Cycle = stack;
        return;
    }
    if (visited[x])
        return;
    for (int i = 0; i < 2 && Cycle.empty(); ++i) {
        stack.push_back(make_pair(x, i));
        visited[x] = true;
        Back(G[x][i], stack, visited);
        stack.pop_back();
        visited[x] = false;
    }
}

void Back(const int x) {
    vector< pair<int, int> > stack;
    vector<bool> visited = vector<bool>(V, false);
    for (int i = 0; i < 2 && Cycle.empty(); ++i) {
        stack.push_back(make_pair(x, i));
        visited[x] = true;
        Back(G[x][i], stack, visited);
        stack.pop_back();
        visited[x] = false;
    }
}
*/
inline int64 Next(const int64 x, const int bits, const int edge) {
    if (edge == 0)
        return x ^ 1;
    int64 y = 0;
    for (int i = 0; i + 1 < bits; ++i)
        if (GetBit(x, i + 1) == GetBit(x, i))
            y ^= (1LL << i);
    return y;
}
/*
void Solve() {
    if (RequiredCycleLength == 1) {
        Length = 1;
        Cycle.push_back(make_pair(0, 1));
        return;
    }
    for (int n = 2; Cycle.empty(); ++n) {
        BuildGraph(n);
        Back(0);
        if (!Cycle.empty())
            Length = n;
    }
}
*/
void WeirdSolve() {
    if (RequiredCycleLength == 1) {
        Length = 1;
        Cycle.push_back(make_pair(0, 1));
        return;
    }
    for (int n = 2; Cycle.empty(); ++n) {
        int64 x = 0;
        int length = 0;
        vector< pair<int64, int> > path;
        multiset<int64> visited;
        if (RequiredCycleLength % 2 == 1) {
            x = Next(0, n, 0);
            visited.insert(x);
            length = 1;
            path.push_back(make_pair(x, 0));
        }
        for (int i = length; i <= RequiredCycleLength && Cycle.empty(); i += 2) {
            int64 y = x;
            for (int j = i; j < RequiredCycleLength; ++j) {
                y = Next(y, n, 1);
                visited.insert(y);
                path.push_back(make_pair(y, 1));
            }
            if (y == 0) {
                bool valid = true;
                if (visited.count(0) > 2)
                    valid = false;
                for (int i = 0; i < int(path.size()) && valid; ++i)
                    if (path[i].first != 0 && visited.count(path[i].first) > 1)
                        valid = false;
                if (valid) {
                    Length = n;
                    Cycle = path;
                    return;
                }
            }
            y = x;
            for (int j = i; j < RequiredCycleLength; ++j) {
                y = Next(y, n, 1);
                visited.erase(visited.find(y));
                path.pop_back();
            }
            if (RequiredCycleLength % 2 == 1) {
                x = Next(x, n, 1);
                visited.insert(x);
                path.push_back(make_pair(x, 1));
                x = Next(x, n, 0);
                visited.insert(x);
                path.push_back(make_pair(x, 0));
            } else {
                x = Next(x, n, 0);
                visited.insert(x);
                path.push_back(make_pair(x, 0));
                x = Next(x, n, 1);
                visited.insert(x);
                path.push_back(make_pair(x, 1));
            }
        }
    }
}

void Read() {
    scanf("%d", &RequiredCycleLength);
}

void Print() {
    PrintBinary(0, Length);
    printf("\n");
    for (int i = 0; i < int(Cycle.size()); ++i)
        printf("%d", Cycle[i].second + 1);
    printf("\n");
    /*for (int i = 0; i < int(Cycle.size()); ++i) {
        PrintBinary(Cycle[i].first, Length);
        printf("\n");
    }*/
}

int main() {
    Read();
    WeirdSolve();
    Print();
    return 0;
}
