Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EI2122Q1DSAF1 - Employees Total Revenue

You are given a list of transactions. Each transaction includes employee id, number of products and sold price. Sort the given list of employees in descending order of total revenue.

Input                                          

-      The first line contains one integer N - the number of transactions (1 £ N £ 105).

-      Each line in the next N lines represents a transaction, contains three integers: Ci, Qi, and Pi, which are the employee’s id, number of products, and price. All integers don’t exceed 109.

Output

The required sorted list. Each line in the output contains the employee’s id and the total revenue.

If there are employees who have same total revenue, they should be sorted in ascending order of id.

Sample

Input

Output

4

1 20 5

2 20 10

1 10 10

3 50 10

3 500

1 200

2 200


Added by:Ha Minh Ngoc
Date:2021-12-20
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: GOSU
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.