Олимпиадный тренинг

Задача 38363. Ka-pants


As you know, pants usually consist of two legs. However, the dog needs, for example, pants of 5 legs (for 4 paws and a tail), and the centipede – pants with 40 legs.

Petya has a Beast with M paws. Sometimes – when it is especially cold outside, in order for the Beast not to catch a cold, it may be necessary to put on several pants so that several trousers are worn on each paw.

Petya's mother left N pants for Petya, having respectively K1, K2, …, KN pants, punishing him to put them all on the Beast . Petya wants to put pants on the Beast so that on the most "insulated" the paw turned out to have as few trousers as possible, but at the same time all the trousers left by the mother were put on the beast. Any pants can be worn on any set of paws (each paw can be found only once in a set).

Help him – Write a program that, for each pair of pants, tells which legs their pants should be on. Please note that two legs of the same pants cannot be worn on the same foot (while legs of different pants can be worn on the same foot).

Input
The number M is entered first, and then the number N (1 ≤ M ≤ 100, 1 ≤ N ≤ 100). Next, N numbers Ki are entered, denoting the number of pants of the pants left by the mother (1 ≤ Ki ≤ M).

Imprint
Print N lines, the i-th line should contain Ki different numbers denoting the numbers of the Beast's paws on which the legs of the i-th pants should be put on. The paws of the Beast are numbered with natural numbers from 1 to M. If there are several required answers, print any of them.
Examples
# Input Output Explanation
1 4 3
1 2 3
1
1 2
2 3 4
First pants worn on paw 1;
the second pants are worn on legs 1 and 2;
the third pants are worn on paws 2, 3 and 4.
Thus, on the most "insulated" paws (and these are paws 1 and 2) are put on 2 legs each.
2 4 2
3 2
1 2 3
4 1
First pants worn on legs 1, 2 and 3;
the second pants are worn on legs 1 and 4.
Thus, the number of pants on the most "insulated" paw (this is paw number 1) – 2.