1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
#include <bits/stdc++.h>


using namespace std;


string wrapForRepeat(const string &s) {
    if (s.size() == 1) {
        return s;
    } else {
        return "[" + s + "]";
    }
}

string repeat(long long n, const string &s) {
    if (n == 1) {
        return s;
    }

    for (int d = 9; d >= 2; d--) if (n % d == 0) {
        return to_string(d) + wrapForRepeat(repeat(n / d, s));
    }

    long long div = n / 9;
    long long rem = n % 9;

    string ans = "";

    if (div > 0) {
        ans += "9" + wrapForRepeat(repeat(div, s));
    }

    if (rem == 1) {
        ans += s;
    } else {
        ans += to_string(rem) + wrapForRepeat(s);
    }

    return ans;
}

string drawRhombus(long long n) {
    string stripe = repeat(n, "F") + repeat(n, "BD") + "B";
    return repeat(n, stripe) + repeat(n, "F");
}

string drawTriangleNoTop(long long n) {
    if (n == 0) {
        return "";
    } else if (n % 2) {
        string ans = "";

        if (n > 1) {
            ans += repeat(n - 1, "AE");
        }

        ans += "A";

        if (n > 1) {
            ans += repeat(n - 1, "C");
        }

        ans += drawTriangleNoTop(n - 1);
        return ans;
    } else {
        long long nSmall = (n - 1) / 2;

        string ans = "A";

        if (nSmall > 0) {
            ans += "2" + wrapForRepeat(drawTriangleNoTop(nSmall));
        }

        ans += repeat(n - 1, "FD");

        if (n > 2) {
            ans += repeat(n - 2, "BD");
        }

        ans += "B";

        if (nSmall > 0) {
            ans += repeat(nSmall, "F");
            ans += drawRhombus(nSmall);
            ans += repeat(nSmall, "B");
        }

        ans += "A";
        return ans;
    }
}

string drawTriangle(long long n) {
    string ans = drawTriangleNoTop(n);
    ans += repeat(n, "E");
    ans += repeat(n, "C");

    return ans;
}

int main() {
    ios_base::sync_with_stdio(false);

    long long n;
    cin >> n;

    cout << drawTriangle(n);

    return 0;
}