P12685 [HackerEarth] valentine shopping 4
普及
题目描述

As it is the Valentines month, Puchi's girlfriend asks him to take her shopping. He, being the average bloke, does not have a lot of money to spend. Hence, decides to buy each item from the shop that offers the best price on it.
His girlfriend wants to buy N items. Each item is available on M shops .
Being the Valentine Season, shops have the products on a discounted price. But, the discounts are in the form of successive discounts. Each shop has a successive discount of order-3 on each of the N products.
Find, for each item, the shop that offers the best price on it.
You may assume that the base price of each item is same on all shops.
Note:
A successive discount of 25% and 50% on an item of Rs 1000, means getting a discount of 50% on the new price, after getting a discount of 25% on original price, i.e item is available at Rs 750 after a 25% discount , and successively at Rs 375 after two successive discounts of 25 and 50.

Input:
First line contains T the number of test cases. T test cases follow.
First line of each test case contains two space-separated integers N and M , the number of items and the number of shops respectively.
It is followed by description of N products. Each product description consists of M lines with 3 integers each, the successive discounts offered on that product.

Output:
Print N space separated integers i.e for the i'th product, print the index (1 ≤ index ≤ M) of the shop that offers the best price for that product.
In case of multiple shops offering the same discount, output the one with lower index.

Constraints:
1 ≤ N, M ≤ 1000
0 ≤ Discounts ≤ 100

Large I/O files.

SAMPLE INPUT
2
1 3
20 20 50
30 20 0
60 50 0
2 2
20 20 20
30 20 40
10 100 90
35 60 50

SAMPLE OUTPUT
3
2 1

输入格式

见题面

输出格式

见题面

样例输入
2 1 3 20 20 50 30 20 0 60 50 0 2 2 20 20 20 30 20 40 10 100 90 35 60 50 SAMPLE
样例输出
3 2 1