Choosing an Exam Set

No attempts yetTime limit1sMemory limit256 MB

Problem

Every year a contest picks the smartest animal in the universe. The first round runs separately in each animal kingdom and looks for a representative with broad knowledge of mathematics, science, social studies, philosophy, art, music and other fields. Each kingdom decides its own format. The rabbit kingdom holds a first round to find the brilliant rabbits hidden across the kingdom.

To keep grading simple, the rabbit kingdom runs the round as a multiple choice exam. Each examiner writes one exam set, and a candidate picks exactly one set to take. The 50 highest scorers advance to the next round. There are NN sets, numbered 1 through NN.

One exam set consists of MM question types. A type is given by three integers XX, YY and ZZ. The type contains ZZ questions, every question in it has XX choices and is worth YY points, and exactly one of the choices is correct.

You know nothing, so you answer every question by picking one choice uniformly at random. A single question with XX choices worth YY points then gives an expected score of Y/XY/X, and the expected score of an exam set is the sum of Z×Y/XZ \times Y / X over all of its types.

Find the number of the exam set with the highest expected score.

Input

The first line contains the number of test cases TT. (1T201 \le T \le 20)

The first line of each test case contains the number of exam sets NN. (1<N1001 < N \le 100)

The exam sets follow in order from set 1 to set NN. Each set starts with a line holding the number of question types MM (1M1001 \le M \le 100), followed by MM lines. Each of those lines holds three integers XX, YY and ZZ separated by spaces. (1<X10001 < X \le 1000, 1Y1001 \le Y \le 100, 1Z1001 \le Z \le 100)

Output

For each test case print one integer on its own line, the number of the exam set with the highest expected score.

If several exam sets share the highest expected score, print the number of the one with the fewest questions among them. If those sets also have the same number of questions, print the smallest number. The number of questions in an exam set is the sum of ZZ over all of its types.

Hint

Within one test case every exam set has the same total point value, which is the sum of Y×ZY \times Z over all of its types.

An expected score is a fraction, so a floating point comparison can make two different values look equal or two equal values look different. Fractions or a common denominator compare exactly.