Agent Encrypto has gone undercover into the enemy territory of CryptoLand to learn their battle plans. His handler Agent Decrypto has hacked their mail servers but he is unable to understand any of the information because it is encrypted in a very secret language called CryptoPerm. It is up to Agent Encrypto now to protect the Nation from the enemies. And he has to hurry because the enemies are starting to get suspicious.
Agent Encrypto has found out that CryptoPerm code works in the following ways:
You have been hired to solve this problem because of your coding skills. Your mission, should you choose to accept is given all encri, all decri and K, you need to find the encrypted form of the alphabet which is the CryptoPerm code. We hope you can save the day.
First line contains T which is the number of test cases.
Each test case contains 3 lines.
For each test case, output a line containing the representation of the alphabet in CryptoPerm.
If the corresponding permutation does not exist, print "Not possible!"(without the quotes) instead.
Case 1: The alphabets b,c,d have already been mapped to be represented by x,y,z respectively. Now we need to find the lexicographically smallest(as K=1) permutation of the alphabet. This is done if we assign each remaining alphabet to the earliest possible position in the permutation. Hence the answer is axyzbcdefghijklmnopqrstuvw.
Case 2: After fixing the given letters in position, 3 letters a,y,z are yet to be mapped. They can be mapped by some permutation of b,y,z. The different permutations of these 3 letters are byz, bzy, ybz, yzb, zby, zyb. Using the 2nd smallest possibility, we get our answer bacdefghijklmnopqrstuvwxzy