#include #include #include #include #include #define LL long long #define inf 0x3f3f3f3f #define eps 1e-6 using namespace std; const int maxn = 100000+10; int c[maxn]; struct node { int L,R,sum; int Mid(){return L+(R-L)/2; } }tree[maxn*4]; void build(int c,int x,int y) { tree[c].L=x; tree[c].R=y; if (x==y) {tree[c].sum=1; return ;} int mid=x+(y-x)/2; build(c*2,x,mid); build(c*2+1,mid+1,y); tree[c].sum=tree[c*2].sum+tree[c*2+1].sum; } void add(int c,int x) { if (tree[c].L==x && tree[c].R==x) { tree[c].sum--; return; } int mid=tree[c].Mid(); if (x<=mid) add(c*2,x); else add(c*2+1,x); tree[c].sum=tree[c*2].sum+tree[c*2+1].sum; } int get(int c,int v) { if (tree[c].L==tree[c].R) return tree[c].L; if (tree[c*2].sum>=v) return get(c*2,v); else return get(c*2+1,v-tree[c*2].sum); } LL a[maxn]; int ans[maxn]; int main() { int T,n; LL x; scanf("%d",&T); while(T--) { scanf("%d",&n); LL sum=0; for (int i=1;i<=n;i++) { scanf("%I64d",&x); a[i]=x-sum+1; sum=x; } build(1,1,n); for (int i=n;i>=1;i--) { ans[i]=get(1,(int)a[i]); add(1,ans[i]); } for (int i=1;i<=n;i++) { int v=n-ans[i]+1; if (i==1) printf("%d",v); else printf(" %d",v); } printf("\n"); } return 0; }