The Game of Eating
题号:NC254988
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Today, Fallleaves01 and his n-1 friends went out for dinner. They intend to order a total of k dishes. To ensure everyone gets their favorite dish, they decided to take turns ordering one dish each in sequential order(i.e., 1st person, 2nd person, ..., n-th person, 1st person, ...) and repeat until they have ordered a total of k dishes.

Please be aware that the dishes ordered by one person can be shared and tasted by everyone. To ensure a wide variety of flavors and experiences, it is important for individuals to avoid ordering the same dish multiple times.

There are a total of m dishes available for selection. Everyone knows each person's preferences for every dish. This information is represented by an n\times m matrix called A, where A_{i,j} denotes the degree to which the i-th person likes the j-th dish.

Assume that each person only cares about their own enjoyment of the dishes without considering others. In other words,if they ultimately choose dishes p_1,p_2..., p_k, person i aims to maximize \sum_{1 \leq j \leq k} A_{i,p_j}.

We also found that for every different 1 \leq x,y \leq m, A_{i,x} \neq A_{i,y}.

Fallleaves01 is curious to know what dishes will be on the table if everyone makes optimal decisions.

输入描述:

The input consists of multiple test cases. The first line of each test case contains an integer t, indicating the number of test cases. The following lines describe each test case.

For each test case, the first line contains three integers n, m, and k (1 \leq n \leq 2000, 1 \leq k \le m \leq 2000). These represent the number of people, the number of dishes, and the number of dishes planned to be ordered, respectively.

The next n lines contain m integers per line. The j-th number on the i-th line represents the degree to which the i-th person likes the j-th dish, denoted as A_{i,j} (1 \leq A_{i,j} \leq 10^9).

It is guaranteed that the sum of n and the sum of m do not exceed 2000.

输出描述:

For each test case, output a row of k integers in increasing order, representing the final selected dishes.
示例1

输入

复制
3
3 4 2
3 2 1 4
3 1 2 4
1 2 3 4
3 4 3
1 2 3 4
3 1 2 4
1 3 2 4
3 20 10
12 25 24 2 23 1 7 17 10 13 9 4 30 29 11 20 14 27 19 18
9 1 22 26 15 16 11 29 18 24 3 21 25 6 19 7 14 13 17 28
26 27 16 2 17 20 12 4 3 1 24 19 9 28 8 18 15 29 13 22

输出

复制
1 4
1 3 4
1 2 3 4 5 8 13 14 18 20

备注:

In case 2:
The 1st person chooses the 3rd dish.
The 2nd person chooses the 1st dish.
The 3rd person chooses the 4th dish.