#include using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); string res,s; int n; priority_queue ,greater> pque; cin >> n; for (int i = 0; i < n; i++) { cin >> s; s += '\xff'; pque.push(s); } while (!pque.empty()) { string now = pque.top(); pque.pop(); res += now[0]; if (now.substr(1).length() > 0) { pque.push(now.substr(1)); } } cout << res << '\n'; return 0; }