P7403 [BalticOI 2002] Tennis Club (Day1)
Description
There are $N$ people who want to make friends with each other. Person $i$ wants to make friends with $G_i$ people.
Find one feasible assignment of friendships.
Input Format
The first line contains an integer $N$, representing the number of people.
The next $N$ lines each contain an integer $G_i$, meaning that person $i$ wants to make friends with $G_i$ people.
Output Format
If there is no solution, output `NO SOLUTION` in one line.
If there is a solution, first output `SOLUTION` in one line.
Then output $N$ lines, where line $i$ contains $G_i$ integers, indicating with which people person $i$ makes friends.
Note that in any solution, the $G_i$ integers in line $i$ must be output in increasing order.
If there are multiple solutions, output any one of them.
Explanation/Hint
#### Constraints
For $100\%$ of the testdata, $2 \le N \le 1000$, $1 \le G_i < N$.
**This problem uses Special Judge.**
#### Notes
Translated from [BalticOI 2002 Day1 B Tennis Club](https://boi.cses.fi/files/boi2002_day1.pdf)。
Translated by ChatGPT 5