# include <iostream>
# include <set>
# include <algorithm>
# include <vector>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int a[n];
        vector<int>v;
        for(int i=0; i<n; i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        int l=a[0];
        cout<<a[0]<<" ";
        for(int i=1; i<n; i++)
        {
            if(a[i]!=l)
            {
                cout<<a[i]<<" ";
                l=a[i];
            }
            else
            {
                v.push_back(a[i]);
            }
        }
        for(int i=0; i<v.size(); i++)
        {
            cout<<v[i]<<" ";
        }
        cout<<endl;
    }
}