The brothers Baq and Babaq enjoy collecting permutations. Babaq's collection is larger than Baq's (it has taken him more time to collect them). For this reason, Baq wants to take some permutations from his brother, but he has a small problem: Babaq has encoded his permutations so that no one can take them away.
The encoding has been done in the following way: If $$$p$$$ is a permutation of the numbers from $$$1$$$ to $$$n$$$, Babaq's encoding is a vector of $$$n$$$ integers $$$c$$$ such that $$$c_i$$$ (the $$$i$$$-th number of $$$c$$$) is the number of integers less than $$$p_i$$$ that appear before $$$p_i$$$ in the permutation. Formally, $$$c_i = |\{j \mid j \lt i \wedge p_j \lt p_i\}|$$$.
Help Baq decode his brother's permutations.
Each case starts with an integer $$$t$$$, the number of permutations that Baq wants to decode. This is followed by the description of the $$$t$$$ permutations to decode. Each encoding is described by an integer $$$n$$$, the number of elements in the permutation, and $$$n$$$ integers $$$c_i$$$ that describe the encoding.
Write $$$t$$$ lines. In the $$$i$$$-th line, write the $$$i$$$-th decoded permutation.
$$$1 \leq n \leq 8, t=36$$$ (21 points)
$$$1 \leq n \leq 2000, t=40$$$ (37 points)
$$$1 \leq n \leq 10^5, t=25$$$ (42 points)
2 3 0 0 2 5 0 1 2 0 2
2 1 3 2 4 5 1 3
| Название |
|---|


