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

int main(){
  int N,L;
  cin>>N>>L;
  vector<string> S(N);
  for(string &s:S)
    cin>>s;
  sort(S.begin(),S.end());
  for(string &s:S)
    cout<<s;
  cout<<endl;
}