#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 30000 + 10;
char s[maxn * 2];
int n, m;
int sa[maxn * 2], rank[maxn * 2], tax[maxn * 2], tp[maxn * 2];
inline bool cmp(int *arr, int x, int y, int l){
return arr[x] == arr[y] && arr[x + l] == arr[y + l];
}
inline void Rsort(){
for(int i = 0; i <= m; i++) tax[i] = 0;
for(int i = 1; i <= n; i++) tax[rank[tp[i]]]++;
for(int i = 1; i <= m; i++) tax[i] += tax[i - 1];
for(int i = n; i; i--) sa[tax[rank[tp[i]]]--] = tp[i];
}
void suffix(){
for(int i = 1; i <= n; i++){
rank[i] = s[i];
tp[i] = i;
}
m = 127;
Rsort();
for(int p, w = 1; p < n; w <<= 1, m = p){
p = 0;
for(int i = n - w + 1; i <= n; i++) tp[++p] = i;
for(int i = 1; i <= n; i++) if(sa[i] > w) tp[++p] = sa[i] - w;
Rsort();
swap(rank, tp);
p = rank[sa[1]] = 1;
for(int i = 2; i <= n; i++)
rank[sa[i]] = cmp(tp, sa[i - 1], sa[i], w) ? p : ++p;
}
}
int main(){
scanf("%d", &n);
for(int i = 1; i <= n; i++){
scanf("%s", s + i);
s[2 * n - i + 2] = s[i];
}
s[n + 1] = ‘ ‘;
n = n << 1 | 1;
suffix();
n >>= 1;
int L = 1, R = n, tot = 0;
while(L <= R){
if(rank[L] < rank[2 * n - R + 2]) putchar(s[L++]);
else putchar(s[R--]);
tot++;
if(tot == 80){
puts("");
tot = 0;
}
}
return 0;
}