#include #include #include #include #include #include #include #include #include #include #include #include #define LL long long #define INF 0x3f3f3f3f #define RR freopen("in.txt","r",stdin) #define WW freopen("out.txt","w",stdout) #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define offset 1000 #define eps 1e-8 #define zero(x) (((x)>0?(x):-(x))eps?1:((x)<-eps?2:0)) using namespace std; const int maxn = 50010; struct node { int L,R; int d; }Sub[maxn*4]; int a[maxn],d[maxn]; void Build(int l, int r, int rt) { Sub[rt].L = l; Sub[rt].R = r; Sub[rt].d = r - l + 1; if(l == r) return ; int mid = (l + r) >> 1; Build(l, mid , rt<<1); Build(mid+1, r, rt<<1|1); } int Query(int n, int rt) { Sub[rt].d--; if(Sub[rt].L == Sub[rt].R) return Sub[rt].R; if(Sub[rt<<1].d < n) return Query(n-Sub[rt<<1].d, rt<<1|1); return Query(n, rt<<1); } int main() { int T, N; scanf("%d", &T); while(T--) { scanf("%d", &N); Build(1, N, 1); for(int i=1; i<=N; i++) { scanf("%d", &a[i]); if(i == 1) continue; d[i] = a[i] - a[i-1]; } for(int i=N; i>0; i--) { a[i] = Query(i-d[i],1); } for(int i=1; i<=N; i++) { printf("%d",a[i]); if(i == N) printf("\n"); else printf(" "); } } return 0; }