#include<bits/stdc++.h>
#define qc ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rt return
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define fi first
#define se second
typedef long long ll;
using namespace std;

int main(){
    qc
    ll t;cin>>t;
    while(t--){
        ll n;cin>>n;
        vector<ll>a(n);
        for(int i=0;i<n;i++)cin>>a[i];
        sort(a.begin(),a.end());
        cout<<a[0]<<" ";
        for(int i=1;i<n;i++){
            if(a[i]!=a[i-1])cout<<a[i]<<" ";
        }
        for(int i=1;i<n;i++){
            if(a[i]==a[i-1])cout<<a[i]<<" ";
        }
        cout<<"\n";
    }
    rt 0;
}
