407128: GYM102697 099 Autobahn
Description
You are about to drive on the Autobahn. You have several different cars, and you're trying to decide which one to take on the Autobahn. The different cars have differing fuel efficiencies, measured in miles per gallon (MPG), and the cars have different top speeds. You calculate a car's score as its fuel efficiency (MPG) multiplied by its top speed.
Given the list of possible cars, your task is to sort them by their score.
InputThe first line of input contains a single positive integer $$$n$$$: the number of cars. The next $$$n$$$ lines each contain the data for a car: the name of the car, its fuel efficiency in MPG, and its top speed.
OutputOutput $$$n$$$ lines, each consisting of a car, sorted by their score as described above. Each line should be in the same format as its corresponding line in the input file. The car with the lowest score should appear first, and the car with the highest score should appear last. If two or more cars have equal scores, sort them alphabetically by the names of each car.
ExampleInput5 Porsche 8 200 Ferrari 7 250 Lamborghini 6 220 BMW 5 230 MercedesBenz 10 160Output
BMW 5 230 Lamborghini 6 220 MercedesBenz 10 160 Porsche 8 200 Ferrari 7 250