A group of friends in the Puzzle Solvers Club love to send one another cryptic messages as part of their weekly challenge games. Recently, they've devised a new system for encrypting their messages, making the puzzles even more intriguing.
It is known that the messages use only lowercase letters, and the encryption method is the Basic Alphabet Permutation Code (BAPC). In this method, each letter in the original message is replaced by another (possibly the same) lowercase letter, forming a one-to-one mapping—all different letters in the original remain different after encryption, so decryption is unique. For example, "hello" can be encrypted as "ifmmp" or "holle", but not as "cnoiz" or "bgrrb".
So far, no one has been able to break the code consistently. However, a breakthrough occurred when a participant accidentally revealed the decrypted version of one of the encrypted messages. While the corresponding encrypted string is unknown, it's certain that it must appear somewhere in the list of exchanged encrypted messages.
Your task is to write a program that, given the original message and a list of encrypted messages, determines which encrypted letter corresponds to which decrypted letter (assuming one encrypted message matches the original). Decrypt as much information as possible.
This information is then used to try to decrypt a newly received encrypted message . For each letter in that can be certainly identified—either directly or by deduction—decrypt it. All other letters should be replaced with a question mark.
Note that, even if multiple messages could match , it may still be possible to determine some decrypted letters (see, for example, the third test case in the sample input).
On the first line, one positive integer: the number of test cases, at most . After that, for each test case:
One line with a single integer (1 \leq n \leq 100): the number of encrypted messages.
lines, each with a single string M_i: the encrypted messages.
One line with a single string : the decrypted message, known to match one of the encrypted messages.
One line with a single string : the message to be decoded.
All strings consist of at least and at most lowercase letters.
For each test case:
One line with a single string . For each letter in , substitute the corresponding decrypted letter if it can be determined; otherwise, use '?'. If there is no encrypted message M_i that could be an encrypted version of , output "IMPOSSIBLE" instead.
Example 1