#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

int main() {
	int N,L;cin>>N>>L;
	map<string,int>mp;
	
	for (int i = 0; i < N; ++i) {
		string st;cin>>st;
		mp[st]++;
	}
	vector<string>use;
	for (auto m : mp) {
		if (m.second) {
			string rev(m.first);
			reverse(rev.begin(),rev.end());
			if (mp.find(rev) != mp.end()) {
				if (rev != m.first) {
					while (mp[rev]&&mp[m.first]) {

						mp[m.first]--;
						mp[rev]--;
						use.push_back(m.first);
					}
				}
				else {
					while (mp[m.first] >= 2) {

						mp[m.first]-=2;
						use.push_back(m.first);
					}
				}
			
			}
		}
	}
	sort(use.begin(), use.end(), [](const string &l, const string&r) {
		return l+r<r+l;
	});
	string ans;
	for (auto u : use) {
		ans+=u;
	}
	string revans(ans);
	reverse(revans.begin(),revans.end());
	ans+=revans;
	for (auto m : mp) {
		if (m.second) {
			string rev(m.first);
			reverse(rev.begin(), rev.end());
			if (m.first == rev) {
				ans.insert(ans.begin()+ans.size()/2,m.first.begin(),m.first.end());
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}