
You are going to implement a Pokemon Go Inventory Display System. Given the name, current hp, and max hp of pokemons, you are going to sort them in the following order.
The pokemon whose hp is not full (i.e. current hp < max hp) goes to the front
The pokemon whose current hp is less goes to the front
The pokemon whose max hp is less goes to the front
Please print the names, current hp, and max hp of the pokemons after you finish sorting. Refer to IO for format.
The input is given in the following format :
n name_1 c_1 m_1 ... name_n c_n m_n
The first line contains an integer n (1 <= n <= 100). The next n lines are the names, current hp and max hp for each pokemon.
It is guaranteed that :
there will be no two pokemons with both same current hp and same max hp
1 <= length of pokemon name <= 20, pokemon name contains English Alphabets only.
0 <= current hp <= max hp <= 1000 for each pokemon
Please print the names, current hp, and max hp of the pokemons after you finish sorting. Each line contains the pokemon's name, current hp, max hp, separated by space. There is no trailing space after max hp. Please add a new line character in the end of each line.