#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF (INT_MAX/3) #define PI (2*acos(0.0)) #define EPS (1e-8) typedef long long ll; typedef unsigned long long ull; int main(){ ios_base::sync_with_stdio(0); int N, size = 0, max_size = 0; cin >> N; vector S(N); for(int i = 0; i < N; i++){ cin >> S[i]; size += S[i].size(); if(S[i].size() > max_size) max_size = S[i].size(); } for(int i = 0; i < N; i++){ for(int j = 0; j < (max_size - S[i].size()); j++) S[i] += "~"; } string T(""); while(size--){ sort(S.begin(), S.end()); T += S[0][0]; S[0].erase(S[0].begin()); S[0] += "~"; if(S[0] == "") S.erase(S.begin()); } cout << T << endl; return 0; }