Problem: Problem

Taro has N character strings, each of which is L in length. Taro loves palindromes, so I want to make palindromes as long as possible by selecting some of the N character strings and arranging them in any order.

Find the longest palindrome that Taro can make. If there are more than one, output the smallest one in lexicographical order. If you can't make a palindrome no matter how you choose and arrange them, output a blank line.

Constraints

The input satisfies the following conditions.

* 1 ≤ N ≤ 1000
* 1 ≤ L ≤ 30
* s_i is a character string consisting of lowercase letters.

Input

The input is given in the following format.


N L
s1
s2
..
..
..
sN


The number N of strings and the length L of strings are given on the first line. From the second line that follows, N & plus; The character string s_i that Taro has is given to the first line.

Output

Output the longest palindrome with the smallest dictionary order. If you cannot make a palindrome, output a blank line.

Examples

Input

4 2
oi
io
rr
rr


Output

iorrrroi


Input

5 1
a
b
c
a
c


Output

acbca


Input

3 3
uki
uku
uke


Output

uku

Solution (in CPP):

Solution:
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int n) { return n & 1; }
constexpr bool even(const int n) { return ~n & 1; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

template<typename String> bool isPalindrome(const String &s) {
  int n = s.size();
  rep(i, n / 2) if (s[i] != s[n - 1 - i]) return false;
  return true;
}

template<typename String> bool isPalindromeOf(String s, const String &t) {
  reverse(all(s));
  return s == t;
}

main {
  int n, l;
  cin >> n >> l;
  vs s(n);
  cin >> s;
  vi used(n);
  V<string> palis;
  rep(i, n) {
    if (used[i]) continue;
    loop(j, i + 1, n) {
      if (used[j]) continue;
      if (isPalindromeOf(s[i], s[j])) {
        used[i] = used[j] = true;
        string t = s[i];
        reverse(all(t));
        palis.emplace_back(min(t, s[i]));
        goto next;
      }
    }
  next:;
  }
  string midS = string(1, char('z' + 1));
  rep(i, n) {
    if (used[i]) continue;
    if (!isPalindrome(s[i])) continue;
    cmin(midS, s[i]);
  }
  sort(all(palis));
  for (auto &t : palis) cout << t;
  if (midS != string(1, char('z' + 1))) cout << midS;
  reverse(all(palis));
  for (auto t : palis) {
    reverse(all(t));
    cout << t;
  }
  cout << endl;
}