AT_abc416_c [ABC416C] Concat (X-th)
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.
When all $ f(A_1,\dots,A_K) $ for the $ N^K $ sequences are sorted in lexicographical order, find the $ X $ -th smallest string.
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ K $ $ X $ $ 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`
When these are sorted in lexicographical order: `abcabc`, `abcabc`, `abcabc`, `abcabc`, `abcxxx`, `abcxxx`, `xxxabc`, `xxxabc`, `xxxxxx`, the $ 6 $ -th is `abcxxx`.
### Constraints
- $ 1\leq N \leq 10 $
- $ 1\leq K \leq 5 $
- $ 1\leq X \leq N^K $
- $ S_i $ is a string consisting of lowercase English letters with length at most $ 10 $ .
- $ N $ , $ K $ , and $ X $ are all integers.