#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=200005;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll qpow(ll a,ll b){ll res=1;while(b){if(b&1) res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
ll inv(ll a,ll p){return qpow(a,p-2);}
int main()
{
    std::ios::sync_with_stdio(false);
    int n,l;
    string s[105];
    cin>>n>>l;
    priority_queue<string,vector<string>,greater<string>> pq;
    for(int i=1;i<=n;i++)
    {
        cin>>s[i];
        pq.push(s[i]);
    }
    while(!pq.empty())
    {
        cout<<pq.top();
        pq.pop();
    }
    cout<<endl;
  //  sort(s[1],s[n+1]);
    return 0;
}
