13450 - Animal World - Life   

Description

There are some animals consisting of cats, fish, birds, and humans in a beautiful world.

 

Whenever an animal's HP turns into 0 or negative, it becomes dead and you should print "<its name> dead" right away.

 

You have to perform the following operations:

  • Birth <name> <species>
    • An animal with name <name>, species <species>, and HP 10 is born.
    • Print "<name> birth" right away.
    • (Note that the animals will be numbered by the order they are born.)
  • Infromation <i>  
    • If the i-th animal is alive, print its name, species, and HP.
  • Talk <i> 
    • If the i-th animal is alive and 
      • cat, print "Meow".
      • fish, print "?".
      • bird, print "Suba".
      • human, print "Hello, world".
  • Breath <i> <x> 
    • If the i-th animal is alive, increase the HP of the i-th animal by x.
  • Sleep <i> <x>
    • If the i-th animal is alive and its HP is less than or equal to 100, multiply its HP by x.
    • (Note that its HP may become larger than 100 after this operation.)
  • Work <i> <x>
    • If the i-th animal is alive, decrease its HP by x.
    • (Note that it may become dead after this operation.)
  • Eat <i> <j>
    • If the i-th animal and the j-th animal are both alive and
      • if the i-th animal is cat and the j-th animal is fish,
      • or the i-th animal is bird and the j-th animal is fish,
      • or the i-th animal is human and the j-th animal is fish or bird,
        • then increase the HP of the i-th animal by the HP of the j-th animal
        • and turn the HP of the j-th animal into 0 (which means the j-th animal dies).
      • If the i-th animal is human and the j-th animal is cat,
        • then turn the HP of the i-th animal into 0 (which means the i-th animal dies).
      • Otherwise, do nothing. 

 

Input

The first line of the input contains a number Q — the number of operations.

The next Q lines is one of the operations described in the statement.

 

Q ≤ 400000

1 ≤ x ≤ 10 in operation Breath, Sleep and Work.

 

Output

Whenever there's an operation "Birth <name> <species>", print "<name> birth".

Whenever there's an operation "Infromation <i>", print the name, species and HP of the i-th animal.

Whenever there's an operation "Talk <i>", print the corresponding sentences according to the problem statement.

Whenever an animal becomes dead, print "<its name> dead".

Remember to print '\n' at the end of each line.

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

13450.cpp

Partial Judge Header

13450.h

Tags




Discuss