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
156
157
158
159
160
161
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = b; i >= a; i--)
#define cat(x) cout << #x << ": " << x << endl

using namespace std;
using ll = long long;

void evenfull(long long, int);
void evendash(long long, int);
void oddfull(long long, int);
void odddash(long long, int);

string res;

void open(string &v, int pw) {
	assert(1 <= pw && pw <= 9);
	v += string(1, '0' + pw);
	v += string(1, '[');
}

void close(string &v) {
	v += string(1, ']');
}

void push(string s, long long pw, string &v = res) {
	if (pw == 1) {
		v += s;
	} else if (pw <= 9) {
		v += string(1, '0' + pw);
		if (s.length() > 1) {
			v += string(1, '[');
		}
		v += s;
		if (s.length() > 1) {
			v += string(1, ']');
		}
	} else {
		int cnt = 0;
		for (;;) {
			if (pw % 9 > 0) {
				open(v, pw % 9);
				v += s;
				close(v);
			}
			pw /= 9;
			if (pw == 0) {
				break;
			}
			cnt++;
			open(v, 9);
		}
		while (cnt--) close(v);
	}
}

void oddfull(long long n, int t) {
	char ch[] = {'D', 'F', 'B'};
	auto get = [&](int k) {
		return string(1, ch[k % 3]);
	};

	if (n == 1) {
		push(get(t + 0), 1);
		push(get(t + 1), 1);
		push(get(t + 2), 1);
		return;
	}

	push(get(t + 0), n);
	push(get(t + 1) + get(t + 2), (n - 1) / 2);
	push(get(t + 1), 1);
	evenfull(n - 1, t);
	push(get(t + 2), 1);
	push(get(t + 1) + get(t + 2), (n - 1) / 2);
}

void evenfull(long long n, int t) {
	char ch[] = {'E', 'A', 'C'};
	auto get = [&](int k) {
		return string(1, ch[k % 3]);
	};

	long long h = n / 2;

	string aux = "";
	push(get(t + 0), h, aux);
	push(get(t + 1) + get(t + 2), h, aux);
	push(get(t + 1), 1, aux);
	push(aux, h);
	push(get(t + 0), n);

	open(res, 2);
	if (h % 2 == 0) {
		evendash(h, t);
	} else {
		odddash(h, t);
	}
	close(res);

	push(get(t + 1), h);
}

void odddash(long long n, int t) {
	char ch[] = {'C', 'E', 'A'};
	auto get = [&](int k) {
		return string(1, ch[k % 3]);
	};

	if (n == 1) {
		push(get(t + 0), 1);
		return;
	}

	push(get(t + 0), 1);
	push(get(t + 2) + get(t + 0), n - 1);
	push(get(t + 1), 1);
	push(get(t + 0) + get(t + 1), n - 2);
	oddfull(n - 2, (t + 1) % 3);
	push(get(t + 0), 1);
}

void evendash(long long n, int t) {
	char ch[] = {'C', 'E', 'A'};
	auto get = [&](int k) {
		return string(1, ch[k % 3]);
	};

	if (n == 2) {
		push(get(t + 0), 1);
		push(get(t + 2), 1);
		push(get(t + 0), 1);
		push(get(t + 1), 1);
		push(get(t + 0), 1);
		return;
	}

	long long h = n / 2;

	push(get(t + 0), 1);
	push(get(t + 2) + get(t + 0), h - 1);
	evenfull(n - 2, (t + 2) % 3);
	push(get(t + 2) + get(t + 0), h - 0);
	push(get(t + 1) + get(t + 0), n - 1);
}

int main() {
	cin.tie(0)->sync_with_stdio(0);

	long long n;
	cin >> n;
	if (n % 2 == 0) {
		evenfull(n, 2);
	} else {
		oddfull(n, 2);
	}
	assert(res.size() <= 150'000);
	cout << res << "\n";

	return 0;
}