Griffy now needs to make friends at Don Mills! Griffy has found
programmer candidates that he may want to make friends with. The IDs of the programmers are labelled
. Each programmer has
different traits, and their total friend-points is the product of all of these traits. Griffy wants to find the top 3 candidates with the most friend-points, and make friends with them! Griffy is not very good at math, so please help him! It is guaranteed that there will be no ties.
Input Specification
First line: A single integer
.
Lines
to
: an integer,
, followed by
space separated integers, representing the candidate's traits (
, for each trait
,
).
It is guaranteed that the friend-points will fit into a 64-bit signed integer.
Output Specification
3 lines, the IDs of the top three candidates sorted in decreasing order of friend-points.
Sample Input
Copy
5
3 2 5 1
2 5 3
3 -2 6 4
4 1 1 1 1
2 10 10
Sample Output
Copy
5
2
1
Explanation for Sample Output
Candidate 5 has
friend-points, candidate 2 has
friend-points, and candidate 1 has
friend-points. These are the top 3 friend-points values.
Comments