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
#include <bits/stdc++.h>

#define ll long long
#define fors(u, n, s) for(ll u=(s); u < (n); u++)
#define foru(u, n) fors(u, n, 0)
#define ir(a, b, x) (((a) <= (x)) && ((x) <= (b)))
#define vec vector
#define pb push_back

using namespace std;

string str_pow(string str, ll n){
    if(n==0) return "";
    if(n==1) return str;
    if(n<=9) return to_string(n) + "[" + str + "]";
    string ans = "9[" + str_pow(str, n/9) + "]";
    if(n%9==0) return ans;
    if(n%9==1) return ans + str;
    return ans + to_string(n%9) + "[" + str + "]";

}

string draw_tri(ll n){ ///DRAW TRIANGLE WITH ONLY BOTTOM SIDE
    if(n==0) return "";
    if(n==1) return "A";
    if(n==2) return "AEACA";

    string ans;
    if(n&1){///n odd case
        ans += "A";
        ans += str_pow("EA" ,n-1);
        ans += str_pow("C", n-1);
        ans += draw_tri(n-1);
        return ans;
    }

    ///n even case
    ans += "A";
    ll m=(n-2)/2; ///smaller triangle
    ans += "2[" + draw_tri(m) + "]";
    ans += str_pow("E", 2*m);
    string clear_row = str_pow("CA", m) + "C" + str_pow("E", m);
    ans += str_pow(clear_row, m);
    ans += str_pow("C", m);
    ans += str_pow("EA", n-1);
    ans += str_pow("CA", n-1);
    return ans;
}

string draw_full_triangle(ll n){
    return draw_tri(n) + str_pow("E", n) + str_pow("C", n);
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll x; cin >> x; cout << draw_full_triangle(x);
    return 0;
}