#include <iostream>
#include <unordered_set>
#include <vector>
using namespace  std;
int main()
{
    
    int t;
    cin >> t;
    for(int i=0;i<t;i++)
    {
        unordered_set<int> st;
        vector<int> v;
        int n;
        cin >> n;
        while(n--)
        {
            int x;
            cin >> x;
            if(st.find(x)==st.end())
            {
                v.push_back(x);
                st.insert(x);
            }
        }
        
        for(auto i=v.begin();i!=v.end();i++)
        {
            cout << *i << ' ' ;
        }
        cout << endl;
    }
    return 0;
}