Name generator
It is quite difficult to come up with a name for a task in Polygon (a system for preparing tasks). That is why it was necessary to automate this process by developing a name generator.
The name of any task should consist of three parts (listed in order): prefix, separator — symbol "_
" (underscore) and suffix. Examples of task names: "amazing_pascal
", "clever_einstein
", "magical_tesla
". Prefix and suffix — words consisting only of lowercase letters of the Latin alphabet, with the prefix chosen only from words in the prefix dictionary and the suffix — in the suffix dictionary.
You have been given of words in the prefix dictionary and of words in the suffix dictionary. You have also been given integers — the numbers of titles to generate. To generate a title numbered , you need to find the -th title (numbering starts at ), among all possible titles sorted in lexicographic order.
Input
The first line contains three integers , and — respectively the size of the prefix dictionary, the size of the suffix dictionary and the number of names to be generated.
Each of the following lines contains the string — a word from the prefix dictionary consisting of only lowercase letters of the Latin alphabet. It is guaranteed that all words in the prefix dictionary are distinct.
Each of the following lines contains the string — a word from the suffix dictionary consisting of only lowercase letters of the Latin alphabet. It is guaranteed that all words in the suffix dictionary are distinct.
The next line gives integers —the numbers of names to be generated.
The entry here denotes the length of the string .
Output
Print lines. In the -th line print the name of the task under the number .
Examples
A string is lexicographically smaller than a string if and only if there exists such that for and (or , ).
Note: the "_
" character is lexicographically smaller than any lowercase letter.