#include <bits/stdc++.h>
using ll = long long;
// #define int ll
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, int(n) + 1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
// const int MOD = 1000000007;

template <typename T>
void __print__(std::ostream &os, const char *, const char *tail, const T &fst) {
    os << fst << tail;
}
template <typename Fst, typename... Rst>
void __print__(std::ostream &os, const char *del, const char *tail, const Fst &fst,
               const Rst &... rst) {
    os << fst << del;
    __print__(os, del, tail, rst...);
}

#ifdef LOCAL
#define dump(...)                                         \
    do {                                                  \
        std::ostringstream os;                            \
        os << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; \
        __print__(os, ", ", "\n", __VA_ARGS__);           \
        std::cerr << os.str();                            \
    } while (0)
#else
#define dump(...)
#endif

template <typename Fst, typename... Rst>
void println(const Fst &fst, const Rst &... rst) {
    __print__(std::cout, "\n", "\n", fst, rst...);
}
template <typename Fst, typename... Rst>
void print(const Fst &fst, const Rst &... rst) {
    __print__(std::cout, " ", "\n", fst, rst...);
}

template <typename iter>
void println_(iter bgn, iter end) {
    while (bgn != end) println(*bgn++);
}

template <typename iter>
void print_(iter bgn, iter end) {
    while (bgn != end) {
        std::cout << *bgn++;
        std::cout << (bgn == end ? "\n" : " ");
    }
}

int _ = (std::cout.precision(10), std::cout.setf(std::ios::fixed), std::cin.tie(0),
         std::ios::sync_with_stdio(0), 0);

template <typename T>
std::vector<T> ndarray(int n, T v) {
    return std::vector<T>(n, v);
}
template <typename... Args>
auto ndarray(int n, Args... args) {
    auto val = ndarray(args...);
    return std::vector<decltype(val)>(n, move(val));
}

template <typename T>
bool umax(T &a, const T &b) {
    return a < b ? a = b, true : false;
}

template <typename T>
bool umin(T &a, const T &b) {
    return a > b ? a = b, true : false;
}

using namespace std;

// make even palind
vector<int> make(const vector<int> &count, const vector<int> &match) {
    int N = count.size();
    vector<int> half;
    rep(i, N) {
        if (match[i] != -1) {
            if (match[i] == i) {
                dump(i, count[i]);
                rep(_, count[i] / 2) half.push_back(i);
            } else if (i < match[i]) {
                rep(_, min(count[i], count[match[i]])) half.push_back(i);
            }
        }
    }
    sort(all(half));
    int k = half.size();
    rep(i, k) {
        half.push_back(match[half[i]]);
    }
    reverse(half.begin() + k, half.end());
    return half;
}

int main() {
    int n, l;
    while (cin >> n >> l) {
        vector<string> ss(n);
        map<string, int> id;
        map<int, string> di;
        rep(i, n) {
            string s;
            cin >> s;
            ss[i] = s;
            id[s];
        }
        sort(all(ss));
        int k = 0;
        for (auto &e : id) {
            e.second = k++;
            di[e.second] = e.first;
        }
        vector<int> count(k);
        rep(i, n) {
            ++count[id[ss[i]]];
        }
        vector<int> match(k, -1);
        for (auto &p : id) {
            for (auto &q : id) {
                string s, t;
                int i, j;
                tie(s, i) = p;
                tie(t, j) = q;
                reverse(all(t));
                if (s == t) {
                    match[i] = j;
                    match[j] = i;
                }
            }
        }

        for (auto &x : ss) {
            dump(x, id[x], count[id[x]], match[id[x]]);
        }

        vector<int> ans = make(count, match);
        dump(ans.size());
        rep(i, k) {
            if (match[i] == i) {
                --count[i];

                vector<int> cand = make(count, match);
                int k = cand.size() / 2;
                cand.insert(cand.begin() + k, i);
                dump(ans.size(), cand.size());
                if (ans.size() < cand.size()) ans = cand;
                else if (ans.size() == cand.size()) ans = min(ans, cand);

                ++count[i];
            }
        }
        dump(ans.size());
        string out;
        for (auto &x : ans) {
            out += di[x];
        }
        cout << out << endl;
    }
}

Measured memory_bytes: 3436