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

using namespace std;

typedef long long int64;

int RequiredCycleLength;
vector< vector<int64> > G;
int N;
int Length;
vector< pair<int64, int> > Cycle;

inline int GetBit(const int64 mask, const int bit) {
    return (mask >> bit) & 1;
}

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;
}

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 int64 x, vector< pair<int64, int> > &stack, set<int64> visited) {
    if (x == stack[0].first) {
        if (int(stack.size()) == RequiredCycleLength)
            Cycle = stack;
        return;
    }
    if (visited.count(x))
        return;
    for (int i = 0; i < 2 && Cycle.empty(); ++i) {
        stack.push_back(make_pair(x, i));
        visited.insert(x);
        Back(Next(x, N, i), stack, visited);
        stack.pop_back();
        visited.erase(x);
    }
}

void Back(const int x) {
    vector< pair<int64, int> > stack;
    set<int64> visited;
    for (int i = 0; i < 2 && Cycle.empty(); ++i) {
        stack.push_back(make_pair(x, i));
        visited.insert(x);
        Back(Next(x, N, i), stack, visited);
        stack.pop_back();
        visited.erase(x);
    }
}

void Solve() {
    if (RequiredCycleLength == 1) {
        Length = 1;
        Cycle.push_back(make_pair(0, 1));
        return;
    }
    for (int n = 2; Cycle.empty(); ++n) {
        N = 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");
    }
}

pair<string, string> FindEvenSolution(const int length) {
    int n = 1;
    for (; n < length; n *= 2);
    n /= 2;
    if (n % 2 == 1)
        n += 1;
    int sideways = length - n;
    string steps = "";
    for (int i = 0; i < sideways / 2; ++i)
        steps += "12";
    for (int i = sideways; i < length; ++i)
        steps += "2";
    string start = "";
    for (int i = 0; i < n; ++i)
        start += "A";
    return make_pair(start, steps);
}

pair<string, string> FindOddSolution(const int length) {
    int n = 1;
    string steps = "";
    
    string start = "";
    for (int i = 0; i < n; ++i)
        start += "A";
    return make_pair(start, steps);
}

void SmartSolve() {
    Read();
    pair<string, string> s;
    if (RequiredCycleLength % 2 == 0)
        s = FindEvenSolution(RequiredCycleLength);
    else {
        s = FindOddSolution(RequiredCycleLength);
        WeirdSolve();
        Print();
        return;
    }
    string start = s.first, steps = s.second;
    printf("%s\n%s\n", start.c_str(), steps.c_str());
}

int main() {
    //SmartSolve();
    Read();
    Solve();
    WeirdSolve();
    Print();
    /*int n = 3;
    vector<int> a;
    int64 x = 0;
    for (; Next(x, n, 1) != 0; x = Next(x, n, 1))
        a.push_back(x);
    a.push_back(x);
    fprintf(stderr, "%d\n", int(a.size()));*/
    return 0;
}
