n, l = gets.split.map(&:to_i)
a = (1..n).map { gets.chomp }.sort
head = ""
tail = ""
deleted = {}
(0..n-1).each do |i|
    next if deleted[i]
    s = a[i]
    r = s.reverse
    j = nil
    (i+1..n-1).each do |k|
        next if deleted[k]
        if a[k] == r
            j = k
            break
        end
    end
    next if !j
    deleted[i] = 1
    head += s
    deleted[j] = 1
    tail = s.reverse + tail
end
c = nil
a.each.with_index do |s, i|
    next if deleted[i]
    next unless s == s.reverse
    c = s if !c || s < c
end
c ||= ""
puts head + c + tail

