Ms. Evans's database stores a number of words consisting of the first English letters. To prevent technicians from seeing sensitive information, the words are encrypted in a very simple way: each English letter is mapped to exactly one English letter, such that no two letters map to the same letter. A letter can map to itself. To encrypt a word, each letter of the word is replaced with the letter it maps to.
For example, if , the following mappings are valid:
The following mappings are not valid:
One of the hard drives failed yesterday, and some information about the mapping has been lost. Specifically, for the letter, it is known that it mapped to either or ( and are among the first English letters; ).
Ms. Evans has a list of questions. Question asks: given what we know about the mapping, is it possible that could map to ? and are strings of equal length composed of the first lowercase English characters. No string will exceed characters in length.
It is guaranteed that the input corresponds to at least one valid mapping.
The first line contains . The of the next lines contains and . The next line contains . The of the next lines contains and .
For each question, output a single line containing the answer: either
Sample Input 1
2 a b a b 4 aa bb aa ab ba aa ab ba
Sample Output 1
YES NO NO YES
Sample Input 2
4 b d a c a b c b 3 a b b b abcd dabc
Sample Output 2
NO NO YES