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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// clang-format off
#include <bits/stdc++.h>

using namespace std;

#define ALL(x) (x).begin(), (x).end()

template<class C> void mini(C &a5, C b5) { a5 = min(a5, b5); }
template<class C> void maxi(C &a5, C b5) { a5 = max(a5, b5); }

#ifdef LOCAL
const bool debug = true;
#else
const bool debug = false;
#define cerr if (true) {} else cout
#endif
// clang-format on

#define int long long
#define double long double

const int INF = 1e18;
const int mod = 1e9 + 7;

void single_repeat_res(int n, deque<char> &res) {
	res.push_front('[');
	res.push_front('0'+n);
	res.push_back(']');
}

deque<char> repeat_pattern(deque<char> &pattern, int n) {
	deque<char> res;
	
	if (n == 0) return res;
	
	if (n >= 9) {
		res = repeat_pattern(pattern, n / 9);
		single_repeat_res(9, res);
	}
	
	n %= 9;
	if (n > 0) {
		if (n > 1) {
			res.push_back('0'+n);
			res.push_back('[');
		}
		for (char c : pattern) {
			res.push_back(c);
		}
		if (n > 1)
			res.push_back(']');
	}
	
	return res;
}

deque<char> repeat_pattern(const string &pattern, int n) {
	deque<char> d(ALL(pattern));
	return repeat_pattern(d, n);
}

void extend_res(deque<char> &res, deque<char> &extension) {
	for (char c : extension) {
		res.push_back(c);
	}
}

void extend_res(deque<char> &res, deque<char> &&extension) {
	for (char c : extension) {
		res.push_back(c);
	}
}

deque<char> square(int n) {
	deque<char> res = repeat_pattern("C", n);
	extend_res(res, repeat_pattern("EA", n));
	res.push_back('E');
	return repeat_pattern(res, n);
}

deque<char> triangle(int n) {
	deque<char> res;
	n--;
	int n2 = n / 2;
	
	if (n < 4) {
		n++;
		if (n == 1) {
			return repeat_pattern("A", 1);
		}
		res = triangle(n-1);
		extend_res(res, repeat_pattern("E", n-1));
		extend_res(res, repeat_pattern("AC", n-1));
		res.push_back('A');
		return res;
		/*n++;
		if (n == 1) {
			return repeat_pattern("A", 1);
		} else if (n == 2) {
			return repeat_pattern("AEACA", 1);
		} else if (n == 3) {
			return repeat_pattern("AEA" + "EAC" + , 1);
		} else if (n == 4) {
			return repeat_pattern("AEAAECCAAEACA", 1);
		}
		for (int i = 0; i < n + 1; i++)
			res.push_back('A');
		return res;*/
	} else {
	
		// 2 triangles
		res = triangle(n2);
		single_repeat_res(2, res);
		
		// go up to the starting point of the missing square
		extend_res(res, repeat_pattern("E", n2));
		
		// fill the missing square
		extend_res(res, square(n2));
		
		// go down filling the right side of the triangle
		extend_res(res, repeat_pattern("AC", n2 * 2));
		res.push_back('A');
	}
	
	if (n % 2) {
		extend_res(res, repeat_pattern("E", n));
		extend_res(res, repeat_pattern("AC", n));
		res.push_back('A');
	}
	
	return res;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin >> n;
    
    deque<char> res = triangle(n);
	extend_res(res, repeat_pattern("E", n));
	extend_res(res, repeat_pattern("C", n));
    
    cerr << res.size() << "\n";
    
    for (char c : res) {
		cout << c;
	}
    
    return 0;
}/*

*/