Broken palindromes

(The original statement in Catalan has some jokes. This English version goes straight to the point of the problem.)

A palindrome has been broken into pieces. Put the pieces together in the right order.

Input

Input consists of several cases. Every case begins with the number of pieces nn. Follow the nn pieces, made up of only lowercase letters. Assume 1n81 \le n \le 8.

Output

For every case, print the palindrome that can be made by joining all the pieces. There is always exactly one solution.

Problem information

Author: Alex Alvarez

Generation: 2026-01-25T11:17:41.230Z

© Jutge.org, 2006–2026.
https://jutge.org