An assessment records n candidates. Each candidate has a distinct integer id, a written mark w, and a viva mark v. A candidate's total score is 3 * w + 2 * v. Rank the candidates from highest total score to lowest. When two candidates have the same total score, the one with the smaller id ranks first. Output the ids in ranked order.
Input format
Line 1: an integer n.
Each of the next n lines: three integers id w v.
Output format
n space-separated integers on one line: the candidate ids in ranked order.
Constraints
- 1 ≤ n ≤ 100000
- ids are distinct, 1 ≤ id ≤ 1000000000
- 0 ≤ w, v ≤ 1000000