This page is still under construction.

Parts of this page are still being built. What you see may change.

Growling Gears

Time limit1sMemory limit256 MB

Summary
For each gear compute the vertex value of -aR^2 + bR + c and output the gear with the largest maximum.
Level

Easy2 of 10

Topics
Math
Solved
No attempts yet

Problem

The Best Acceleration Production Company builds engines with several gears. The performance of an engine in a given gear is measured by the amount of torque it produces, and that amount is not constant. Torque depends on the RPM of the engine, and the relationship is described by a torque-RPM curve.

In the latest line of engines, the torque-RPM curve of every gear is a parabola of the form T=−aR2+bR+cT = -aR^2 + bR + c, where RR is the RPM of the engine and TT is the resulting torque. RR is a real number.

Given the parabolas that describe all gears in an engine, determine the gear in which the highest torque is produced. The first gear is gear 1, the second gear is gear 2, and so on. Exactly one gear produces the highest torque. In every test case that gear's maximum torque is at least 1 higher than the maximum torque of every other gear.

Input

The first line contains the number of test cases, which is at least 1 and at most 100. Each test case is given in the following format.

  • One line with a single integer nn (1≤n≤101 \le n \le 10): the number of gears in the engine.
  • nn lines, each with three space-separated integers aa, bb and cc (1≤a,b,c≤10 0001 \le a, b, c \le 10\,000): the parameters of the parabola T=−aR2+bR+cT = -aR^2 + bR + c that describes the torque-RPM curve of that gear.

Output

For each test case, print one line with a single integer: the gear in which the maximum torque is generated.

Examples1

  1. Example 1

    Input
    3
    1
    1 4 2
    2
    3 126 1400
    2 152 208
    2
    3 127 1400
    2 154 208
    
    Expected output
    1
    2
    2