#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second

vector<int> solve(vector<int> A) {

    map<int,int> mp;
    map<int, bool> np;

    vector <int> x;
    vector <int> y;
    for (int i=0; i<A.size(); i++) {
        mp[A[i]]++;
        np[i]=false;
        if (mp[A[i]]%2==1) {
            x.push_back(A[i]);
            y.push_back(i);
            np[i]=true;
        }
    }
    for (int i=0; i<A.size(); i++) {
        if (np[i]==false) y.push_back(i);
    }

    return y;
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t ;
    for (int test=1; test<=t; test++) {
        int n;
        cin >> n ;
        vector <int> a(n);
        for (int i=0; i<n; i++) {
            cin >> a[i] ;
        }

        for (auto ind : solve(a)) {
            cout << ind << " ";
        }
        cout << endl ;
    }
    cout << endl ;
    return 0;
}