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.

EI20213FQ3 - The Highest Revenue

You are given a list of transactions, each of them includes transaction code, product code, selling price, and quantity.

For each product, you have to find out the selling price at which the revenue is the highest. If there are more than one product that have the same highest revenue, print the lowest price.

Input

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

-      Each line in the next N lines contains four integers representing a transaction. All of them are not exceed 109

Output

For each product, output the product code and the required selling price and the highest revenue.  The list of products should be sorted in ascending order of product code

Sample

https://drive.google.com/file/d/1FxoUcbMxkKt4mbsfK-S7MfXoviDsO1i4/view?usp=sharing

Input

Output

5

1111 1 1000 5

1112 2 100 1

1113 1 500 10

1114 2 99 1

1115 3 100 2

 

1 500 5000

2 100 100

3 100 200


Added by:Ha Minh Ngoc
Date:2021-07-19
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.