#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;
struct chuan {
string str0;
};
int cmp(chuan x, chuan y) {
return x.str0 > y.str0;
}
int main()
{
int n;
int result;
string str00;
vector<chuan> str;
struct chuan temp;
cin >> n;
for (int i = 0; i < n; i++) {
cin>>temp.str0;
str.push_back(temp);
}
sort(str.begin(), str.end(), cmp);
for (int i = 0; i < n; i++) {
str00 += str[i].str0;
}
cout << str00;
}