Nature
In nature, there are alimentary chains. At the basis of this chain, we generally have the vegetals. Small animals eat those vegetals and bigger animals eat the smaller. There can be cycles in the chain, as when some animal dies he starts a decomposition process which will transform its body into minerals that are a source of energy for the vegetals.
In this problem you will have to find the largest alimentary chain for a given group of creatures. You can consider that if is predator of then they are in the same chain.
Input
Contains several input sets. The description of each set is given below:
each set starts with two integers , the number of creatures, and , the number of relations. Follow lines with the names of the creatures, each consisting of lower case letters . No name is longer than letters. Then there will be lines describing the relations. Each line will have names of creatures, meaning that the second creature is a predator of the first one.
You can assume that no creature is a predator of himself. Input is terminated by a set where . This set should not be processed. There is a blank line beteween two input sets.
Output
For each input set produce one line of output, the size of the largest alimentary chain.