extern crate core;

use std::fmt;
use std::cmp::{Ordering, min, max};
use std::f32::MAX;
use std::ops::{Add, Sub, Mul, Div, Neg, Index, IndexMut, SubAssign, Range};
use std::collections::{BTreeMap, VecDeque, BinaryHeap, BTreeSet, HashMap};
use std::fmt::Display;

fn show<T: Display>(vec: &Vec<T>) {
    if vec.is_empty() {
        println!("[]");
    }else {
        print!("[{}", vec[0]);
        for i in 1 .. vec.len() {
            print!(", {}", vec[i]);
        }
        println!("]");
    }
}
fn show2<T: Display>(vec: &Vec<Vec<T>>) {
    if vec.is_empty() {
        println!("[]");
    }else {
        for l in vec {
            show(l);
        }
    }
}

macro_rules! read_line{
    () => {{
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).ok();
        line
    }};
    (delimiter: ' ') => {
        read_line!().split_whitespace().map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (delimiter: $p:expr) => {
        read_line!().split($p).map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (' ') => {
        read_line!(delimiter: ' ')
    };
    ($delimiter:expr) => {
        read_line!(delimiter: $delimiter)
    };
    (' '; $ty:ty) => {
        read_line!().split_whitespace().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
    ($delimiter:expr; $ty:ty) => {
        read_line!($delimiter).into_iter().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
}
macro_rules! read_value{
    () => {
        read_line!().trim().parse().ok().unwrap()
    }
}
macro_rules! let_all {
    ($($n:ident:$t:ty),*) => {
        let line = read_line!(delimiter: ' ');
        let mut iter = line.iter();
        $(let $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
    };
}

macro_rules! let_mut_all {
    ($($n:ident:$t:ty),*) => {
        let line = read_line!(delimiter: ' ');
        let mut iter = line.iter();
        $(let mut $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
    };
}
fn is_palindrome(word: &Vec<char>) -> bool {
    for i in 0 .. word.len() / 2 {
        if word[i] != word[word.len() - 1 - i] {
            return false
        }
    }
    true
}
fn can_make_palindrome(prefix: &Vec<char>, suffix: &Vec<char>) -> bool {
    for i in 0 .. prefix.len() {
        if prefix[i] != suffix[suffix.len() - 1 - i] {
            return false
        }
    }
    true
}
fn main() {
    let_all!(n: usize, l: usize);
    let mut words: Vec<Vec<char>> = Vec::with_capacity(n);
    for _ in 0 .. n {
        words.push(read_line!().trim().chars().collect());
    }
    words.sort();
    let mut is_free = vec![true; n];
    let mut use_mid: Option<usize> = None;
    let mut prefix = Vec::new();
    for i in 0 .. n {
        if is_free[i] {
            for j in i + 1 .. n {
                if is_free[j] && can_make_palindrome(&words[i], &words[j]) {
                    is_free[i] = false;
                    is_free[j] = false;
                    prefix.push(i);
                    break
                }
            }
            if is_free[i] && use_mid.is_none() && is_palindrome(&words[i]) {
                is_free[i] = false;
                use_mid = Some(i);
            }
        }
    }
    let mut result = VecDeque::new();
    if let Some(i) = use_mid {
        for &c in &words[i] {
            result.push_back(c);
        }
    }
    for &i in prefix.iter().rev() {
        for &c in words[i].iter().rev() {
            result.push_front(c);
            result.push_back(c);
        }
    }
    println!("{}", result.into_iter().collect::<String>());
}


Measured memory_bytes: 5056