#Lutece0344. Cryptoquote

Cryptoquote

Migrated from Lutece 344 Cryptoquote

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

A cryptoquote is a simple encoded message where one letter is simply replaced by another throughout the message. For example:

  • Encoded: HPC PJVYMIY
  • Decoded: ACM CONTEST

In the example above, H=AH=A, P=CP=C, C=MC=M, J=OJ=O, V=NV=N, Y=TY=T, M=EM=E and I=SI=S. For this problem, you will decode messages.

Input

The first line of input contains a single integer NN,(1N10001\leq N\leq 1000) which is the number of data sets that follow. Each data set consists of two lines of input. The first line is the encoded message. The second line is a 2626 character string of upper case letters giving the character mapping for each letter of the alphabet: the first character gives the mapping for AA, the second for BB and so on. Only upper case letters will be used. Spaces may appear in the encoded message, and should be preserved in the output string.

Output

For each data set, you should generate one line of output with the following values: The data set number as a decimal integer (start counting at one), a space and the decoded message.

Samples

输入数据 1

2 
HPC PJVYMIY 
BLMRGJIASOPZEFDCKWYHUNXQTV 
FDY GAI BG UKMY 
KIMHOTSQYRLCUZPAGWJNBVDXEF

输出数据 1

1 ACM CONTEST 
2 THE SKY IS BLUE

Resources

Greater New York 2008