A common but insecure method of encrypting text is to permute the letters of the alphabet. That is, in the text, each letter of the alphabet is consistently replaced by some other letter, with no two letters replaced by the same letter to ensure reversibility.
Your task is to decrypt several encoded lines of text, assuming that each line uses a different set of letter replacements, and that all words in the decrypted text are from a given dictionary.
The input consists of a line containing an integer , followed by words, one per line, in alphabetical order. All letters in the dictionary words are uppercase. These words make up the dictionary of words which may appear in the decrypted text. After the dictionary, several lines follow, each containing encrypted text as described above.
The dictionary contains no more than words. Each word contains no more than letters. The encrypted lines contain only lowercase letters and spaces and do not exceed characters in length.
Decrypt each line and print it to standard output. If there is more than one solution, any will do. If there is no solution, output the line with every letter replaced by an asterisk (***...).
Esempio 1