Problem list
Log in
#r03357 · Online Judge > GoldOJ

Sort by Three Scores

Silver IV 2.0 s 1024 MB

Sort students by: first score descending; then second score ascending; then third score descending; then name ascending. Print only the names, in order.

Input

First line $N$; then $N$ lines each with a (distinct) name and three scores $A$, $B$, $C$ ($1 \le N \le 1000$, $0 \le A, B, C \le 100$).

Output

Print the sorted names, one per line.

Example 1

Input
5
Alice 90 80 70
Bob 90 70 80
Carol 90 70 90
Dave 80 100 100
Eve 90 70 90
Output
Carol
Eve
Bob
Alice
Dave

Example 2

Input
6
JIN 100 50 90
MIN 100 40 80
SEO 100 40 95
KIM 90 10 100
LEE 100 40 95
HAN 100 50 95
Output
LEE
SEO
MIN
HAN
JIN
KIM
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code