A company has the annual sales information. The sale price and the number of units sold are known for each product. The company wishes to process this information to obtain the list of products ordered by gross income. The gross income of a product is the amount generated by all sales of the product.
You MUST use the following struct definition to solve the problem:
struct Info{ string code; int gross_income; };
Exam score: 3.000000 Automatic part: 0.000000%
Input
The input consists of zero or more cases. Each case consists of an integer n≥0 followed by the information of n products. The information of a product consists of a string that corresponds to the product identifier and two integers that respectively represent the sale price and the number of units sold.
Output
For each case, the list ordered by gross income of the products as shown in the examples. In the case of a tie (when two products have generated the same gross income) will appear before the one that has a lower identifier. After each listing a blank line should be printed.
Input
5 X34Z21T 7 3532 Y44BB2V 3 5005 Z346K 1 50041 PR5678U 15 998 F834TR 150 10 4 ZA678FD 3 100 XFH66A4 1 200 YG4S 150 2 SS7623T 15 20 4 QT8A 50 0 QS0934B 99 0 QR9043A 45 0 4TTTTT4 27 0
Output
Z346K 50041 X34Z21T 24724 Y44BB2V 15015 PR5678U 14970 F834TR 1500 SS7623T 300 YG4S 300 ZA678FD 300 XFH66A4 200 4TTTTT4 0 QR9043A 0 QS0934B 0 QT8A 0