#P1675. [USACO05FEB] Jersey Politics G

[USACO05FEB] Jersey Politics G

Description

In Wisconsin, there are 3×k3 \times k cities, labeled 1,2,,3×k1, 2, \cdots, 3 \times k in order. Each city has 10001000 cows. Jersey owns w1,w2,,w3×kw_1, w_2, \cdots, w_{3 \times k} (0wi10000 \leq w_i \leq 1000) cows in these cities.

You need to evenly split these cities into 33 groups. Clearly, each group then has a total of 1000×k1000 \times k cows.

You must ensure that in at least two groups, the total number of cows owned by Jersey is strictly greater than half of 1000×k1000 \times k.

Find any valid assignment.

Input Format

The first line contains an integer kk.

Then follow 3×k3 \times k lines, each containing one integer wiw_i.

Output Format

Output three groups. For the ii-th group, output kk lines, each line containing the index of a city assigned to the ii-th region.

2
510
500
500
670
400
310
1
2
3
6
5
4

Hint

There may be multiple valid solutions; output any one of them.

Constraints: 1k601 \le k \le 60.

Translated by ChatGPT 5