#include "bits/stdc++.h" using namespace std; int main() { int N; cin >> N; vector S(N); int cnt = 0; for (int i = 0; i < N; i++) { cin >> S[i]; cnt += S[i].size(); } string ans = ""; for (int t = 0; t < cnt; t++) { sort(S.begin(), S.end()); for (int i = 0; i < S.size(); i++) { if (S[i] != ""){ ans += S[i][0]; string temp = ""; for (int j = 1; j < S[i].size(); j++) { temp += S[i][j]; } S[i] = temp; break; } } } cout << ans << endl; cin >> ans; }