#include"bits/stdc++.h" //#include using namespace std; #define print(x) cout< PI; typedef pair V; const ll mod = 10000000000; int main() { int n; string s[52]; cin >> n; REP(i, n) { cin >> s[i];} string ans=""; while (true) { string m="z"; int mi=-1; REP(i, n) { if (s[i].empty())continue; if (m == "z"||m > s[i]) { m = s[i]; mi = i; } } if (mi == -1)break; ans += m[0]; s[mi].erase(s[mi].begin() + 0); } print(ans); return 0; }