SMALBOYS - Small Boys and The Prinicpal

no tags 

There were small school boys who were bunking their classes. The principal caught all those boys and now, they have to arrange themselves according to their heights as the principal was strict. (To align themselves according to their heights in increasing order was something which was taught)

But, all the boys know the number of boys who are smaller than him. Can you give the principal the order of their positions? :)

Input

First Line contains an integer 'T', the number of test cases. The first line of each test case indicates the number of boys 'X'.

In the next line there are 'X' spaced integers. The i'th integer signifies the number of boys which have height less than i.

Constraints

1 <= t <= 1000

0 <= X <= 1000

Output

For every test case, output the formation of the boys in a separate line [ the i'th integer is the rank of the boy(in terms of height) that comes i'th in the height formation ]

Example

Input:
4
6
0 1 2 3 4 5
5
0 0 0 0 0
5
0 1 1 1 4
4
0 0 1 3
Output: 1 2 3 4 5 6
5 4 3 2 1
1 4 3 2 5
2 3 1 4

hide comments
Jacob Plachta: 2014-04-22 11:36:59

This problem is basically a clone of http://www.spoj.com/problems/IITWPC4D/, except that this one is much less clear (in fact, it's completely missing key information).

For example, each boy knows "the number of boys who are smaller than him [who are in line to the left of him]", and the input description should say that "the i'th integer signifies the number of boys which have height less than i [and are in line to the left of the boy with height i]".

--ans(Francky)--> Thanks for your comment. In those conditions ; this problem doesn't belong to classical. Moved to tutorial, and hidden waiting for clarifications.

Kaushik --> I tried to change the sentences on my own. Sorry. This one was the original question.
https://616e529e-a-c8e0004d-s-sites.googlegroups.com/a/iiitd.ac.in/foobar/contests/prosort13/prob-HANARM.pdf?attachauth=ANoY7cp_Gi2tDo7ZWgbgoJDEm7Ywf0cWihg3oomjORmccOwApE_WfEiWs_LvAvl84bgCBTPVCYXya8lwduUL2ptMGS6EJiGLNHXxKypj4d2AcKMK-xJRF5enyKA8GzIJnC6bKm7A2S-bRDmv4sVxnU46TRpUHFzLo5eUpAk3nfG0s5nPHLmNHaLmWXTZ31QPqVG2n_LpF6pgUfCd1Vkh6bGKUWXgyx60v861JrFf3I9A4HOH1UZrRkg%3D&attredirects=0

--edit(Francky)--> Now visible.

Last edit: 2014-04-22 16:33:57
Flago: 2014-04-22 11:00:27

Any tricky case ?

Tanmay: 2014-04-21 23:30:51

Just a small trick in the end. Test-cases are great :)

Kaushik: 2014-04-21 23:30:51

I'll update the problem. The time-limit was less so I thought people should have guessed it.

Apoorv Gupta: 2014-04-21 23:30:51

constraints ?


Added by:Kaushik
Date:2014-04-21
Time limit:0.300s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Foobar