AT_abc416_g [ABC416G] Concat (1st)

Description

You are given $ N $ strings $ S_1,\ldots,S_N $ . For a sequence $ (A_1,\ldots,A_K) $ of length $ K $ where all elements are between $ 1 $ and $ N $ , inclusive, define the string $ f(A_1,\ldots,A_K) $ as $ S_{A_1}+S_{A_2}+\dots+S_{A_K} $ . Here, `+` represents string concatenation. Among all $ f(A_1,\dots,A_K) $ for the $ N^K $ sequences, find the lexicographically smallest string.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ K $ $ S_1 $ $ \vdots $ $ S_N $

Output Format

Output the answer.

Explanation/Hint

### Sample Explanation 1 - $ f(1,1)= $ `abcabc` - $ f(1,2)= $ `abcxxx` - $ f(1,3)= $ `abcabc` - $ f(2,1)= $ `xxxabc` - $ f(2,2)= $ `xxxxxx` - $ f(2,3)= $ `xxxabc` - $ f(3,1)= $ `abcabc` - $ f(3,2)= $ `abcxxx` - $ f(3,3)= $ `abcabc` Among these, the lexicographically smallest is `abcabc`. ### Constraints - $ 1\leq N \leq 10^5 $ - $ 1\leq K \leq 10^5 $ - $ S_i $ is a string consisting of lowercase English letters with length at most $ 10 $ . - $ N $ and $ K $ are integers.