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
#include <iostream>
#include <algorithm>

inline void print(const std::string& str) {
    std::cout << str;
}

class compressor {
private:
    const static int N = 1e5 + 1;
    std::string dp[N];

public:
    void init(int n) {
        dp[0] = "";
        dp[1] = "*";
        dp[2] = "2*";
        dp[3] = "3*";
        dp[4] = "4*";
        dp[5] = "5*";
        dp[6] = "6*";
        dp[7] = "7*";
        dp[8] = "8*";
        dp[9] = "9*";
        for (int i = 10; i <= n; i++) {
            dp[i] = std::min({
                "2[" + dp[i/2] + "]" + dp[i%2],
                "3[" + dp[i/3] + "]" + dp[i%3],
                "4[" + dp[i/4] + "]" + dp[i%4],
                "5[" + dp[i/5] + "]" + dp[i%5],
                "6[" + dp[i/6] + "]" + dp[i%6],
                "7[" + dp[i/7] + "]" + dp[i%7],
                "8[" + dp[i/8] + "]" + dp[i%8],
                "9[" + dp[i/9] + "]" + dp[i%9]
                }, [](const std::string& a, const std::string& b) -> bool {
                    return a.length() < b.length();
                }
            );
        }
    }
    std::string compress(int k, char c) const {
        std::string result = dp[k];
        int n = dp[k].length();
        for (int i = 0; i < n; i++) {
            if (result[i] == '*') result[i] = c;
        }
        return result;
    }
    std::string compress(const int k, const std::string& c) const {
        std::string result;
        int n = dp[k].length();
        for (int i = 0; i < n; i++) {
            if (dp[k][i] == '*') {
                if (result.empty() || result.back() == ']') result += c;
                else result += ("[" + std::string(c) + "]");
            } else {
                result += dp[k][i];
            }
        }
        return result;
    }

};


void gen_level(int k, const compressor& cmp) {
    print(cmp.compress(k, 'A'));
    print(cmp.compress(k-1, "EC"));
    print("E");
}

int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0); std::cout.tie(0);
    
    int n; std::cin >> n;
    
    compressor comp;
    comp.init(n);

    for (int i = n; i >= 1; i--) {
        gen_level(i, comp);
    }
    print(comp.compress(n, 'C'));
}