One of the utilities of the trees is the classification of animal and vegetal species. (To see an instance, consult the pdf or ps version of this wording.)
Write a program that reads a classification of species, and that afterwards for each given individual decides which specie belongs to. As we do not have physical information of the individuals, we will use a generator of pseudorandom numbers to choose for which branch of the phylogenetic tree is necessary to go down until finding a leaf. As a seed of the pseudorandom generator, for each given name we will use the sum of its first character, of its second character multiplied by two, of its third character multiplied by four, etc.
Input
Input consists of a general tree of words with the format explained at the exercise . Afterwards, the description of a generator of pseudorandom numbers comes as is explained at the exercise , except that the initial seed s is not given (because it depens on each given number). Finally, a series of names of indivuals are given.
Output
For each name of the input, your program must print wich specie it belongs to following the format of the instance.
Observation
Choose between the r children of a node (even if r = 1) using the code of the exercise as it is given.
Input
42 Primates 2 Prosimians 4 lemurs 0 aye-aye 0 lorises 0 tarsiers 0 Simians 2 New_world_monkeys 4 Cebidae 4 marmoset 0 tamarin 0 capuchin 0 squirrel_monkey 0 night_monkey 0 Pitheciidae 3 titis 0 sakis 0 uakaris 0 Atelidae 3 alouatta 0 ateles 0 woolly_monkey 0 Catarrhini 2 Old_world_monkeys 2 Cercopithecidae 4 cercopitec 0 macaques 0 baboon 0 mandrill 0 Colobinae 4 colobus 0 langur 0 rhinopithecus 0 snub_nosed_monkey 0 Hominoidea 2 gibbons 0 Hominidae 2 orangutans 0 Hominine 3 gorilla 0 chimpanzees 0 human 0 606961 964 217495 Xita Floquet_de_neu Omer Jordi Salvador
Output
Xita: chimpanzees Floquet_de_neu: gorilla Omer: woolly_monkey Jordi: aye-aye Salvador: human