#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    string c;
    priority_queue<string,vector<string>,greater<string> >q;
    for(int i=0;i<a;i++){
        cin>>c;
        q.push(c);
    }
    while(q.size()>0){
        string b;
		b=q.top();
        cout<<b;
        q.pop();
    }
    cout<<endl;
    return 0;
}