Automatic translation

Given nn words in one language XX, and a text with mm words written in another language YY, print all the possible translations of the text to XX, assuming that there is a bijection between the words of XX and YY.

Input

Input consists of several cases. Every case begins with nn, followed by the nn words of the language XX, in increasing order, each one made up of between one and six lowercase letters. Follow mm, followed by the mm words of the text written in YY, each one made up of between one and six uppercase letters. This text contains exactly nn different words. Assume 1n61 \le n \le 6 and nm1000n \le m \le 1000.

Output

For every case, print in alphabetical order all the possible translations of the text in YY to XX. Print a line with 10 dashes at the end of each case.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T10:12:25.406Z

© Jutge.org, 2006–2026.
https://jutge.org