#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) int main() { ios_base::sync_with_stdio(0); cin.tie(0); priority_queue, greater > Q; string ret; int n; cin >> n; REP (i, n) { string s; cin >> s; Q.push(s + "|"); } while (!Q.empty()) { string x = Q.top(); Q.pop(); ret += x[0]; x = x.substr(1); if (x != "|") Q.push(x); } cout << ret << endl; return 0; }