#include #include #include using namespace std ; vector w ; int d[3] ; int o[6][3] = {{0,1,2},{0,2,1},{1,0,2},{1,2,0},{2,0,1},{2,1,0}} ; const int s = 6 ; void recur(int at) { if (at == (int)w.size()) { int used = d[0] | d[1] | d[2] ; int fc = 0 ; for (int i=0; i<3; i++) { if (i) cout << ' ' ; for (int j=0; j<26; j++) if ((d[i] >> j) & 1) cout << (char)('a'+j) ; for (int j=__builtin_popcount(d[i]); j> fc) & 1) fc++ ; used |= 1< s) good = 0 ; } if ((d[0] & d[1]) || (d[0] & d[2]) || (d[1] & d[2])) good = 0 ; if (good) recur(at+1) ; for (int i=0; i<3; i++) d[i] = od[i] ; if (at == 0) return ; } } int main() { int n ; cin >> n ; w.resize(n) ; for (auto &s: w) cin >> s ; recur(0) ; cout << 0 << endl ; }