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

int main()
{
	string sr[200];
	int n,m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> sr[i];
	sort(sr, sr + n);
	for (int i = 0; i < n; i++)
		cout << sr[i];
	cout << endl;
	return 0;
}

