A Cypriot dance group is rehearsing a routine to Fuego, the song performed by Eleni Foureira for Cyprus at Eurovision 2018. For the lighting effect, the stage lamps will be switched on one by one.
There are $$$n$$$ lamps in a row, numbered from $$$1$$$ to $$$n$$$ from left to right. Initially, all lamps are off. At each step, exactly one lamp that is still off is switched on. After $$$n$$$ steps, all lamps are on.
A lit segment is a maximal nonempty group of consecutive lamps that are on. For example, if lamps $$$2$$$, $$$3$$$, and $$$5$$$ are on in a row of $$$5$$$ lamps, there are two lit segments: $$$[2,3]$$$ and $$$[5,5]$$$.
For every $$$i$$$ from $$$1$$$ to $$$n$$$, you are given a number $$$a_i$$$: the required number of lit segments immediately after step $$$i$$$. Find any order of switching on the lamps that gives these numbers, or determine that no such order exists.
The first line contains one integer $$$n$$$ ($$$1\le n\le 1000$$$), the number of lamps.
The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$0\le a_i\le n$$$), the required numbers of lit segments.
If no suitable order exists, print $$$-1$$$.
Otherwise, print a permutation $$$p_1,p_2,\ldots,p_n$$$ of the integers from $$$1$$$ to $$$n$$$, where $$$p_i$$$ is the lamp switched on at step $$$i$$$. If there are several suitable orders, print any of them.
51 2 1 2 1
1 3 2 5 4
41 2 1 2
-1
11
1
In the first example, lamps are switched on in the order $$$1,3,2,5,4$$$. Filled circles are lit lamps, arrows mark the newly lit lamp, and bars show the lit segments.
In the second example, the final number of lit segments must be $$$1$$$, so the required sequence is impossible. In the third example, the only lamp is switched on.
| Name |
|---|


