Hard
Legend Sorted by Peak
Read n series, each line
label v1 v2 …. Plot them in that order, but build the legend so the series with the highest peak comes first (ties keep input order). Print the legend texts in order.Input
n, then n lines.
Output
Lines.
Sample 1
Input
3 A 1 2 3 B 5 1 C 2 2
Output
B A C
Sample 2
Input
1 Only 4
Output
Only
Output appears here