Gregor Mendel was an Austrian monk. His experiments showed how inheritance works.
We shall simulate a simplied genetic model for this problem. Given a list of people who were tested for a particular genetic trait several generations ago and the outcome of the test, the program should list descendants who come from a line of individuals who do not have this genetic trait.
The input consists of several lines. The first line will number those people who were tested. For each, a name and a test result will follow. This test result is either "PRESENT" or "NOT PRESENT".
The next line will list the number of descendants the tested group had. For each descendant, that decendant's name is listed alongside its parents names. The format for this line is:
[DESCENDANT_NAME]:[PARENT1_NAME],[PARENT2_NAME]NOTE: Names may contain spaces
4 John Smith NOT PRESENT Mary Jones NOT PRESENT Edel Williams PRESENT Alan Wood NOT PRESENT 5 Tom Smith:Mary Jones,John Smith Anne Smith:Mary Jones,John Smith Kid1 Wood:Edel Williams,Alan Wood Kid2 Wood:Edel Williams,ALan Wood New kid:Anne Smith,Kid2 Wood
Tom Smith Anne Smith