#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define pb push_back #define mp make_pair #define fillchar(a, x) memset(a, x, sizeof(a)) #define copy(a, b) memcpy(a, b, sizeof(a)) #define lson rt << 1, l, mid #define rson rt << 1|1, mid + 1, r #define root 1, 1, N typedef long long LL; typedef pair PII; typedef unsigned long long uLL; template void print(T* p, T* q, string Gap = " ") { int d = p < q ? 1 : -1; while(p != q) { cout << *p; p += d; if(p != q) cout << Gap; } cout << endl; } template void print(const T &a, string bes = "") { int len = bes.length(); if(len >= 2)cout << bes[0] << a << bes[1] << endl; else cout << a << endl; } const int INF = 0x3f3f3f3f; const int MAXM = 2e5; const int MAXN = 1e5 + 5; int T, N, RT; int X[MAXN]; int S[MAXN << 2]; int D[MAXN]; void pushup(int rt){ S[rt] = S[rt << 1] + S[rt << 1 | 1]; } void build(int rt, int l, int r){ if(l == r) { S[rt] = 1; return; } int mid = (l + r) >> 1; build(lson); build(rson); pushup(rt); } void updata(int p, int rt, int l, int r){ if(l == r){ S[rt] = 0; return; } int mid = (l + r) >> 1; if(p <= mid) updata(p, lson); else updata(p, rson); pushup(rt); } int query(int p, int rt,int l, int r){ if(l == r) { return l; } int mid = (l + r) >> 1; int ret; if(p <= S[rt << 1]) ret = query(p, lson); else ret = query(p - S[rt << 1], rson); return ret; } int main(){ scanf("%d", &T); X[0] = 0; while(T --){ scanf("%d", &N); for(int i = 1;i <= N;i ++){ scanf("%d", &X[i]); } build(root); for(int i = N ;i > 0;i --){ int t = query(i - (X[i] - X[i - 1]), root); updata(t, root); D[i] = t; } print(D + 1, D + 1 + N); } return 0; }