Hacker

Find the first string t such that the strings from S to t contain exactly K strings sharing t's rolling-hash value, then print those K strings.

Medium6Hash mapMathImplementationNo attempts yetTime limit0.5sMemory limit128 MB

Problem

Bruno turns words into numbers with a rolling hash.

His algorithm works like this.

  1. Start with hash 00.
  2. Read the characters of the string from left to right. For each one, multiply the current hash by PP and add the position of that character in the alphabet (11 to 2626).
  3. The final hash is the remainder of that value divided by MM.

Ivan got hold of a list of every string of length NN over the lowercase English letters, sorted lexicographically. The paper was torn, so only the part that begins with the string SS and ends with zz...z\texttt{zz...z} is left.

Ivan wants to find KK distinct strings from the remaining list that have the same hash. Help him break Bruno's algorithm.

Input

The first line contains the positive integers PP and MM from the statement. (1P,M1000001 \le P, M \le 100000)

The second line contains NN, the length of the strings on the list. (1N1000001 \le N \le 100000)

The third line contains the string SS, the first string of the remaining list. It has length NN and consists of lowercase English letters.

The fourth line contains KK, the number of strings Ivan wants. (1K201 \le K \le 20)

Output

The answer is fixed by this rule. Scan the remaining list in lexicographic order starting at SS. Stop at the first string tt for which the strings from SS to tt include exactly KK strings whose hash equals the hash of tt. Print those KK strings in lexicographic order, one per line. The last line is tt.

If you reach the end of the list without any hash value collecting KK strings, print the single word NEMOGUCE\texttt{NEMOGUCE}.