#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); array,26> B{}; vector ans; auto dfs = [&](auto&& dfs, int v) -> void { for (int to = 0; to < 26; to++) { if (B[v][to]) continue; B[v][to] = true; dfs(dfs, to); ans.push_back(string(1, v + 'A') + string(1, 'A' + to)); } }; dfs(dfs, 0); reverse(ans.begin(), ans.end()); for (const string& s : ans) cout << s << '\n'; }