#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){
	int n,l;
	while(~scanf("%d %d",&n, &l)){
		string str;
		vector<string>v1;
		for(int i = 0; i < n ; i++){
			cin >> str;
			v1.push_back(str);
		}
		sort(v1.begin(),v1.end());
		for(vector<string>::iterator it = v1.begin(); it != v1.end(); it++){
			cout << *it;
		}
	}
	return 0;
}
