#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t=0;
	cin >> t;
	while(t--){
		int n;
		cin >> n;
		int arr[n];
		map <int,int> mp; //number , count.
		for(int i=0;i<n;i++)
			{
				cin >> arr[i];
				mp[arr[i]]++;
			}
		std::vector<int> v;
		std::vector<pair<int,int>> v1; //numb,cnt
		for(auto p : mp){
			if(p.second  > 1)
				v1.push_back({p.first,p.second-1});
			v.push_back(p.first);
		}
		for(int i=0;i<v1.size();i++){
			while(v1[i].second){
				v.push_back(v1[i].first);
				v1[i].second--;
			}
		}
		for(int x : v)
			cout << x << " ";
		cout << '\n';
	}
}