#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; string s[55]; int main() { int n; cin >> n; priority_queue,greater> q; for (int i = 0; i < n; i++) { cin >> s[i]; q.push(s[i] + '{'); } string ans = ""; while (!q.empty()) { string s1 = q.top(); q.pop(); if (s1[0] != '{') { ans += s1[0]; q.push(s1.substr(1, s1.size() - 1)); } } cout << ans << endl; }