Iroha has a sequence of
N
strings
s1
,
s2
, .. ,
sN
. Each line is
L long. Iroha wants to concatenate all strings to get a very long string. Among all the strings it can get in this way, find the lexicographically smallest one.
We will assume that the string
s = s1s2...sn
is lexicographically less than the string < code>t = t
1t
2...t
m if one of the following conditions is true:
- there is an index
i
(
\(1<=i<=min(n,m)\)) such that
\(s_j =t_j \), for all indices
j
(
\(1<=j<= i\)), and
\(s_i <t_i \);
-
\(s_i=t_j\)
for all
i
(
\(1<=i<=min( n,m)\)), and
\(n<m\).
Input
The first line contains numbers
N
and
L
. Next are the lines
s1
,
s2
, ..,
sN< /sub>
, each on a separate line.
Imprint
Print the lexicographically smallest string that Iroha can create.
Examples
# |
Input |
Output |
1 |
3 3
dxx
ax
cxx |
axxcxxdxx |