The rules of the German language allow for the creation of interesting words like Rindfleischetikettierungs"uberwachungsaufgaben-"ubertragungsgesetz. This word contains $$$65$$$ letters and translates to "law on the transfer of responsibilities for beef labeling".
The Jeerman language has taken this concept even further. A word is defined as any sequence of non-space characters. The value of a word is determined by the number of distinct words from a given base set that appear as substrings within it. Your task is to generate a word of a specified length such that its value is maximized.
The first line contains two integers $$$N$$$ and $$$K$$$ ($$$7 \leq N \leq 14$$$, $$$2 \leq K \leq 10$$$). This is followed by $$$K$$$ lines, each containing a unique base word composed of lowercase English letters. The length of each word does not exceed $$$7$$$.
Output a string of length $$$N$$$ that possesses the maximum possible value. If several strings achieve this maximum value, output any one of them.
10 4 eneki beneki eli varenik
benekieliz
10 4 a aa aaa aaaa
abcaaaabaa
In the first example, the value of the word is $$$3$$$, while in the second example, it is $$$4$$$.