CSES - Aalto Competitive Programming 2024 - wk5 - Mon - Freight trains
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Maija drives freight trains between the big cities of Europe. On her next trip, she is going to tow n cars numbered 1,2,\dots,n. The ID of the i-th car is a_i which is a string consisting of no more than 10 lowercase Latin letters. The trains should be ordered by their IDs. As no further standards restrict the IDs, sorting the cars by their IDs becomes confusing. Therefore it has been decided that the cars should be sorted in such a way that the concatenation of IDs is lexicographically minimum. Help Maija sort the cars.

Input

First line contains a single integer n.

The i-th of next following n lines, contains a single string a_i.

Output

Print the lexicographically minimal concatenation of the strings.

Constraints

  • 1 \leq n \leq 10^5
  • 1 \leq |a_i| \leq 10
  • a_i \neq a_j if i \neq j

Example 2

Input:

3
ca
cab
de

Output:

cabcade

Example 1

Input:

10
acg
bcggd
dcg
dede
e
f
fc
fdbb
g
gabb

Output:

acgbcggddcgdedeefcfdbbfgabbg