All problems

Picking Features by Correlation

mediumPythonFeature Engineering

Quillon Energy has more columns than it wants to train on, and needs a quick first cut. For each column, someone has already worked out its correlation with the thing being predicted: a number between -1 and 1 saying how tightly the two move together, where 1 means they rise in lockstep, -1 means one rises exactly as the other falls, and 0 means no relationship at all. A column that falls as reliably as another rises is just as useful, so a correlation of -0.85 counts as stronger than one of 0.75. The team wants the single strongest column named, and they want the answer to be the same whatever order the columns were listed in.

Task: Print the name of the strongest column.

Input

The first line holds one integer n, the number of columns. Each of the next n lines holds a column name and its correlation, separated by a single space; a name contains no spaces and a correlation may be negative.

Output

One line holding the name of the column whose correlation is strongest. If two or more are exactly equally strong, print whichever of them comes first alphabetically.

Example:

Input:
3
age 0.2
income 0.75
height -0.85

Output:
height

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…