#include<bits/stdc++.h>
using namespace std;

int main()
{
int num,len;
cin>>num>>len;
string s;
vector<string> v;
while(num--)
{
cin>>s;
v.push_back(s);
}

sort(v.begin(),v.end());
for(auto i:v)
cout<<i;
return 0;
}