The king of Utopia has died without leaving any descendants. Because the king named no successor, the royal nobles have each begun to claim the throne. The law of Utopia states that when the king has no successor, the person whose bloodline is closest to the country's founder shall rule.
The person whose bloodline is closest to the founder is a descendant of the founder whose blood is the least diluted by people other than the founder. Everyone inherits half of their bloodline from their father and half from their mother. A child of the founder carries $\frac{1}{2}$ of the royal blood, and if that child marries someone who is not royalty, their child carries $\frac{1}{4}$ of the royal blood. In this way, the fraction of blood inherited from the founder is determined generation by generation.
Write a program that, among the people claiming the throne, finds the one whose bloodline is closest to the founder, that is, the one who carries the largest fraction of the royal blood.
The first line contains two integers $N$ and $M$. ($2 \le N, M \le 50$)
The second line contains the name of the founder of Utopia.
Each of the next $N$ lines contains one piece of family information: three names separated by spaces. The first name is a child, and the other two names are that child's two parents.
Each of the next $M$ lines contains, one per line, the name of a person claiming the throne.
Every name is a string of 1 to 10 lowercase English letters. The founder never claims the throne and never appears as anyone's child.
Print the name of the person whose bloodline is closest to the founder. The input is always such that the answer is unique.
Because the family relationships in this problem are built without regard to gender or age, some cases may not make sense in reality. However, every child has a unique pair of parents, no child is ever an ancestor of its own parents (there are no cycles), and no single person appears as a child more than once.