By Jessica Dagostini, URI Online Judge Brazil
Oh the Christmas time... magic time, time of good senses, dinners full of cool people and filled with good food and, of course: many gifts!
Jucilena was a good girl in this year. Knowing it, she is making a list with her christmas wishes. However, Jucilena is an undecided girl (and her wishes are many), what makes Nicolau confused from what present she really wants. On their lists, cast the name of the desired gift, its value (this field prompted by her mother) and the preference of the same in a scale, from the least preferred (1) to the most desired (10). Seeing this idea, Jucilena's friends also do the same, because all have various gift options.
All this messing lists and gifts left, Santa Claus is crazy! Seeing this, the Christmas spirit has touched you and you decided to help Santa, creating a program that shows the list of the most desired gifts for Jucilena and his friends. Gifts should be shown in descending order of preference. If the preference of one another is the same, it should be shown the lowest value first. If there is similarity between preference and value, they should be listed in alphabetical order.
The input consist in many test cases. The first line of each test case contains the Name (without spaces) of respective owner of the list, together with a integer Q (1 < Q <100) whats define a quantity of gifts listed. The next Q*2 lines consist in a name O of the desired object in a line and the P (1< P < 100.000.000) cost of the same the prefer's value E (1< E < 10) in the next line.
The ordered list should be printed within the guidelines outlined above, being first shows the name of the owner of preceded by "Lista de ", followed by a list that only shows the object name followed by its value in Brazilian real, with two digits after the decimal point. Should be printed a blank line after all outputs.
|Input Samples||Output Samples|
Colecao Harry Potter
Assinatura 1 ano Netflix
Cd The Script
Lista de Jucilena