ORDERS - Ordering the Soldiers

题意翻译

军士长XYJ手下一共有n个士兵,每个士兵按照身高从矮到高编号为1到n。可惜这群士兵太笨了,第一次排好后现在又忘记怎么排了。站在XYJ面前的士兵虽然排成了一列,但是顺序就不一定是从1到n了。 XYJ想了如下的一个办法让他们排列整齐: 从最前面的士兵开始,每个士兵一直往前排直到碰到一个编号比自己小的士兵(身高小于自己)为止,然后该士兵就站在这个位置。不一会儿,队伍调整好了。 XYJ觉得很满意,不过为了提高效率,他要士兵们记住,这次调整的过程中,每个人各自往前走了几个人的位置。 现在给你这样一个任务:告诉你在排队过程中每个人往前走了几个人的位置,请你告诉我最初这个队伍的顺序是怎样的。有多组测试数据。 Input 输入第一行为一个整数t(t<=50)为数据组数,每组数据第一行输入一个整数n(1<=n<=200000),接下来一行输入n个整数,第i个数代表原来队伍中排在第i个位置的人在调整过程中往前走了几个人的位置。 Output 每组数据输出包含一行,共n个整数,从左往右第i个数代表最初在队伍中第i个人的编号。相邻两个整数用一个空格隔开。

题目描述

As you are probably well aware, in Byteland it is always the military officer's main worry to order his soldiers on parade correctly. In Bitland ordering soldiers is not really such a problem. If a platoon consists of n men, all of them have different rank (from 1 - lowest to n - highest) and on parade they should be lined up from left to right in increasing order of rank. Sounds simple, doesn't it? Well, Msgt Johnny thought the same, until one day he was faced with a new command. He soon discovered that his elite commandos preferred to do the fighting, and leave the thinking to their superiors. So, when at the first rollcall the soldiers lined up in fairly random order it was not because of their lack of discipline, but simply because they couldn't work out how to form a line in correct order of ranks. Msgt Johnny was not at all amused, particularly as he soon found that none of the soldiers even remembered his own rank. Over the years of service every soldier had only learned which of the other soldiers were his superiors. But Msgt Johnny was not a man to give up easily when faced with a true military challenge. After a moment's thought a solution of brilliant simplicity struck him and he issued the following order: "men, starting from the left, one by one, do: (step forward; go left until there is no superior to the left of you; get back in line).". This did indeed get the men sorted in a few minutes. The problem was solved... for the time being. The next day, the soldiers came in exactly the same order as the day before, and had to be rearranged using the same method. History repeated. After some weeks, Msgt Johnny managed to force each of his soldiers to remember how many men he passed when going left, and thus make the sorting process even faster. If you know how many positions each man has to walk to the left, can you try to find out what order of ranks the soldiers initially line up in?

输入输出格式

输入格式


The first line of input contains an integer t<=50, the number of test cases. It is followed by t test cases, each consisting of 2 lines. The first line contains a single integer n (1<=n<=200000). The second line contains n space separated integers w $ _{i} $ , denoting how far the i-th soldier in line must walk to the left when applying Msgt Johnny's algorithm.

输出格式


For each test case, output a single line consisting of n space separated integers - the ranks of the soldiers, given from left to right in their initial arrangement.

输入输出样例

输入样例 #1

2
3
0 1 0
5
0 1 2 0 1

输出样例 #1

2 1 3
3 2 1 5 4