The scientific committee of the 26th ACM/ICPC, who design the contest problems, use the following encryption scheme to exchange problem drafts securely over the Internet. To encrypt a text, every occurrence of each letter is replaced by another letter (possibly itself), so that no two distinct letters are encrypted to the same letter — that is, the substitution is a bijection over the 26 uppercase letters. Both the original and the encrypted texts consist only of uppercase letters and blanks; blanks are never encrypted and are copied to the encrypted text exactly. For example, under the table A→Z, B→Y, C→X, …, Z→A, the string THIS IS THE FIRST SAMPLE is encrypted as GSRH RH GSV URIHG HZNKOV.
A recipient has lost the encryption table, but has a dictionary that contains every word that may appear in the problems. Help him build a decryption table that restores the original draft from the encrypted one. Given the dictionary of possible original words and the encrypted text, find an encryption table such that decrypting the encrypted text yields a text in which every word occurs in the dictionary.
The first part of the input is a dictionary shared by all test cases. Its first line contains d (1≤d≤50000), the number of dictionary words, followed by d lines each holding one word. The dictionary words are given in alphabetical order and are all uppercase. Each word has at most 20 characters, and the total length of all dictionary words is at most 350,000.
The next line contains a single integer t (1≤t≤10), the number of test cases. Each test case is preceded by a single blank line and consists of one or more lines that together form the encrypted text. Every such line contains only uppercase letters and blanks. No word is split across a line break, and each line may contain any number of trailing blanks. The length of each input line is at most 80.
Print exactly t lines, one per test case. Each line must be a string of 26 uppercase characters: the encryption of ABCDEFGHIJKLMNOPQRSTUVWXYZ under the encryption table used in that test case (position i is the letter that the i-th letter of the alphabet is encrypted to). Some letters may never appear in the decrypted text; for every such letter, print * at its position instead. If the test case has no valid table, print #No solution#. If more than one encryption table is possible (that is, the decrypted text is not uniquely determined), print #More than one solution#.