Sohee decided that keeping a public key and a private key in sync was too much trouble, so she built a cipher that uses only public keys and named it the ironclad security algorithm.
A word is a string of 1 to 10 uppercase letters (A-Z), and a sentence is a list of words separated by single spaces.
The first public key is a sentence in which no word appears twice.
The second public key is the first public key with its words moved to new positions.
A plaintext is a sentence with the same number of words as the first public key. Unlike the key, it may use the same word more than once.
The ciphertext is the plaintext with its words moved the very same way. That is, if the i-th word of the second public key is the j-th word of the first public key, then the i-th word of the ciphertext is the j-th word of the plaintext.
Given the two public keys and a ciphertext, recover the plaintext.
The first line has the number of test cases, which is at most 100.
Each test case takes four lines.
Every word is 1 to 10 uppercase letters.
For each test case, print the recovered plaintext on one line, with a single space between words.