#include<bits/stdc++.h>
#define int long long

using namespace std;

void solve(vector<int> a) {
    int n = a.size();
    vector<pair<int, int> > b(n);
    for (int i = 0; i < n; ++i) {
        b[i].first = a[i];
        b[i].second = i;
    }
    sort(b.begin(), b.end());
    vector<int> ans(n);
    for (int i = 0; i < n; ++i) {
        ans[i] = b[i].second;
    }
    reverse(b.begin(), b.end());
    /*for (auto i : ans) {
        cout << i << ' ';
    }
    cout << '\n';*/
    return ans;
}

signed main() {
    int t = 1;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
        }
        solve(a);
    }
}
