Time limit
2s
Memory limit
128 MB
A country has 3K cities, where 1 <= K <= 60. Every city has exactly 1,000 residents. A political party has counted how many supporters it has in each city, and it can choose how to divide the cities into three election districts.
There must be three districts, and each district must contain exactly K cities. A district supports the party if the number of supporters in that district is greater than half of its population, which is 500K. If at least two of the three districts support the party, the party wins the election.
Given the number of supporters in each city, output a division of the cities into three districts that makes the party win.
The first line contains K.
The next 3K lines contain the number of supporters in city 1 through city 3K, in order.
Print 3K lines in total.
The first K lines must contain the city numbers in district 1, one per line. The next K lines must contain the city numbers in district 2, and the last K lines must contain the city numbers in district 3.
The input is guaranteed to have at least one valid answer. If several answers are possible, output any one of them.