#include #include using namespace std; class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x s(n, string()); for(int i : range(n)) { cin >> s[i]; s[i] += 'z' + 1; } string t; for( ; ; ) { int p = -1; for(int i : range(n)) { if(s[i].size() > 1 && (p == -1 || s[p] > s[i])) { p = i; } } if(p < 0) { break; } t += s[p][0]; s[p] = s[p].substr(1); } cout << t << endl; return 0; }