Your task is to write a program to decode messages encripted by using the method just described.
The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs.
Input data file contains the alphabetical key in the first line, the numerical key in the second line, the number of messages that are to be deciphered in the third line, and a ciphered text message in each of the remaining lines. These text messages only contain uppercase letters in the standard 26–letter English alphabet and, if it is the case, also a space between words. These text messages supposedly result from the encryption of several original plaintext messages using the method described above with the cipher key given in the first and second lines of the input file.
For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line.
For each of the input ciphered text messages, output of the original plaintext message is required or an error message ('error in encryption') in case the input text is not a correct encryption of any plaintext message. The order of the messages must be preserved.