#include <iostream>
#include <algorithm>
using namespace std;
bool cmpstr(string a, string b){
for (int i = 0; i < min(a.size(), b.size()); ++i) {
if (a[i] != b[i]) return a[i] > b[i];
}
return a.size() < b.size();
}
void M(){
int n;
cin>>n;
string *s = new string[n];
for (int i = 0; i < n; ++i) cin>>s[i];
sort(s, s+n, cmpstr);
for (int i = 0; i < n; ++i) {
cout<<s[i];
}
}
int main(){
M();
return 0;
}