In the famous play Hamlet by William Shakespeare, the theme of revenge is built up mainly through the main character, Hamlet. The effect that this theme has on the direction of the play is evident through Hamlet’s actions. As Hamlet progresses down the path of revenge, his actions become more illogical, resulting in him harming himself and others.
This theme initially reveals itself when Hamlet converses with the ghost of his dead father, the former king of Denmark. The ghost informs Hamlet that his death was not accidental and that the current king and uncle to Hamlet, Claudius, is responsible. Hamlet tells his friend and scholar Horatio that he does not trust the ghost yet and is planning to investigate Cladius, but from his later actions, we see him lean towards what the ghost says.
As Horatio is a good friend, he wants to understand the true meaning behind Hamlet’s madness and what he says. After careful observation, Horatio has determined an alternate meaning to certain words Hamlet says. Unfortunately, Horatio is unable to apply these translations in real-time. Given a list of these words and their true meaning, help Horatio translate what Hamlet says.
Input Specifications
The first line contains integer , the number of translations to consider.
The next lines contain a word with the number of letters ranging from , followed by its true meaning separated by a space.
The following line consists of integer , .
The next line contains words, the number of words that Hamlet speaks, .
The final line will be something Hamlet says, words separated by a space to be translated.
There will be no punctuation and letters may be capitalized. All words to be translated and their true meanings will be unique from each other.
Output Specifications
Output the quote translated with the true meaning.
Sample Input 1
1
ghost father
7
I trust and will follow my ghost
Sample Output 1
I trust and will follow my father
Explanation
the word ghost
is replaced by the word father
to get the sample output.
Comments