B. Cat Cut
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

You are given $$$N$$$ strings $$$S_1, \dots, S_N$$$, each consisting of lowercase English letters and having length $$$M$$$.

Initially, let $$$X = S_1$$$, and perform the following operation $$$N-1$$$ times.

In the $$$i$$$-th operation, let $$$Y$$$ be the string formed by concatenating $$$X$$$ and $$$S_{i+1}$$$ in this order. Then, choose any contiguous substring of $$$Y$$$ of length $$$M$$$, and replace $$$X$$$ with that substring.

Output the lexicographically smallest string that can possibly be the final value of $$$X$$$.

Input

The first line contains integers $$$N, M$$$ in this order. ($$$2 \leq N \leq 2000, 1 \leq M \leq 2000$$$)

Each of the following $$$N$$$ lines contains a string $$$S_i$$$ of length $$$M$$$, consisting of lowercase English letters.

Output

Print the answer.

Examples
Input
2 3
cat
cut
Output
atc
Input
2 1
a
b
Output
a
Input
3 8
jastaway
tatesoto
soryuusi
Output
asoryuus
Note

In the first example, initially $$$X=$$$ cat.

In the first operation, $$$Y=$$$ catcut. If we choose the contiguous substring from the $$$2$$$-nd to the $$$4$$$-th character, then $$$X=$$$ atc, which is the lexicographically smallest possible.