#include <bits/stdc++.h>
#include<string>
using namespace std;
  
#define  flp(i,a,b)         for(int i=a;i<b;i++)
#define  inarr(arr,n)		for(int i=0;i<n;i++){ cin>>arr[i] ;}
#define  outarr(arr,n)		for(int i=0;i<n;i++){ cout<<arr[i]<<endl;}
  
int main(){
	
	int t;
	cin>>t;
	
	
	while(t--){
	
	int n;
	cin>>n;
	int arr[n];
	inarr(arr,n);
	vector <int> l;
	unordered_map<int,int> dic;
	sort(arr,arr+n);
	flp(i,0,n){
		dic[arr[i]]++;
	}
	int ct=0;
	unordered_map<int,int> done;
	flp(i,0,n){
		if(dic[arr[i]]==1){
			cout<<arr[i]<<" ";
			done[arr[i]]=1;
		}
		else if(dic[arr[i]]>1 && done[arr[i]]==0){
			cout<<arr[i]<<" ";
			done[arr[i]]=1;
		}
	}
	unordered_map<int,int>cat;
	flp(i,0,n){
		if(dic[arr[i]]>1 && done[arr[i]]<dic[arr[i]]){
			cout<<arr[i]<<" ";
			done[arr[i]]++;
		}
	}
	
	/*
	int ans=0;
	if(ans==0){
		cout<<"NO";
	}
	else{
		cout<<"YES";
	}
	*/
	
	
	cout<<endl;
	
	
		
	}
	
	return 0;
}
