#include <bits/stdc++.h>
using namespace std;

map<int,int> mp;

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

    int w=x.size();
    for (int i=0; i<w; i++) x.push_back(x[i]);

    return x;
}
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;
}
