While cleaning your parents' attic, you found a box of documents that describe the relationships among your ancestors. Using these documents, you want to answer a number of questions about the relationships they imply. Fortunately, every ancestor has a unique name, so many facts can be inferred without confusion.
Every relationship (given or inferred) satisfies the following rules:
The information is always consistent, and you may assume there are no relationships other than those explicitly stated or implied by the rules above.
The first part of the input is a list of known relationships, one per line, in the form:
NAME is NAME's RELATIONSHIP.
Here NAME is a lowercase alphabetic word (never the word is), and RELATIONSHIP is one of:
This part ends with a blank line. There is at least one known relationship, and at most 100 distinct names appear among the known relationships.
Next comes a list of questions, one per line, in the form:
is NAME NAME's RELATIONSHIP?
where NAME is as above and RELATIONSHIP is one of:
Every name used in the questions also appears in the known relationships. The list of questions ends at end of file.
For each question, print a single line containing yes or no if the answer can be determined, or unknown if the answer could be either yes or no because the sex of the relevant person(s) cannot be determined from the known relationships.