#include #include #include using namespace std; struct cmp{ bool operator()(const string& a, const string& b){ return a + b > b + a; } }; int main(){ set a; int n; cin >> n; string tmp; for(int i = 0;i < n; i++){ cin >> tmp; a.emplace(tmp); } for(string x : a){ cout << x ; } cout << endl; return 0; }