All problems

Sizing Points by a Numeric Column

mediumPythonSeabornsize

Fernbrook Analytics sometimes needs a third number on a panel that only has two axes left, so the dots are scaled: a record with a bigger weight gets a bigger marker. Oversized markers swallow their neighbours, so the review checklist asks which record is producing the largest one, in order to go and check that record before the panel is signed off.

Task: Print the position of the record with the largest weight.

Input

The first line holds one integer n, the number of records. Each of the next n lines holds that record's two measurements and its weight, separated by single spaces.

Output

One line holding a single whole number: the position of the record carrying the largest weight. Positions start at 0, so the first record sits at position 0. The weight itself is not printed. If several records share the largest weight, report the earliest of them.

Example:

Input:
3
1 1 10
2 2 50
3 3 20

Output:
1

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…