There are a number of animals who are grouped in enclosures. Write a program that keeps track of which enclosure each animal belongs to. Each animal has a name and a species among the four types “elephant”, “frog”, “cat”, or “undefined”.
The input starts with an integer
denoting the number of animals. The next
lines are on the format
“animal
type
animal
name”,
where
animal
type
is the type of the animal (Elephant, Frog, Cat or Animal) and
animal
name
is the name of the animal.
The next line has an integer
denoting the number of enclosures. The enclosures are given on the
following lines on the format
“enclosure
name
,
where
is the number of animals in the enclosure. Each enclosure is followed by
lines with the names of the animals.
For each animal in the order they appear in the input, print the
following line:
X is of the species Y
For each enclosure in the order they appear in the input, print the
following line:
Enclosure Z contains animals AA, BB, CC, ...
All placeholders (X, Y, Z, AA, BB, CC) should be replaced with the
appropriate name or species (see the sample output for an example).
Input
4 Animal Pikatxu Elephant Jumbo Frog Kermit Cat Puss in Boots 2 A 2 Pikatxu Jumbo B 2 Kermit Puss in Boots
Output
Pikatxu is of the species ...undefined... Jumbo is of the species elephant Kermit is of the species frog Puss in Boots is of the species cat Enclosure A contains animals Pikatxu, Jumbo Enclosure B contains animals Kermit, Puss in Boots