- 93
Statement
Goal
In your barnyard, you have rabbits, chickens, cows, pegasi and demons.You gather your animals and you count the heads, the horns, the legs, the wings and the eyes.
Every animal has one head.
The rabbits have four legs and two eyes.
The chickens have two legs, two wings and two eyes.
The cows have two horns, four legs and two eyes.
The pegasi have four legs, two wings and two eyes.
The demons have four horns, four legs, two wings and four eyes.
You are given a list of the species that you have and the total number of heads, horns, legs, wings and eyes.
You must print the number of animals of each species that are in your barnyard (in the same order that they were given).
Input
Line 1: The number n of species
Line 2: The list of n species you have
Next n lines: The list of characteristics that you have counted followed by its number
Line 2: The list of n species you have
Next n lines: The list of characteristics that you have counted followed by its number
Output
Print the number of each animal you have, one species per line.
Constraints
2⩽n⩽5
Example
Input
2 Rabbits Chickens Heads 5 Legs 14
Output
Rabbits 2 Chickens 3
A higher resolution is required to access the IDE