#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
long long int a[100000], b[10000], n, k, l, m, i, j, p, q, r, t;
int main()
{
	cin >> t;
	while (t--)
	{
		cin >> n;
		for (i = 0; i < n; i++)
			cin >> a[i];
		sort(a, a + n);
		if(1==2)
		cout<<2<<endl;
	
		for (i = 0; i < n - 1; i++)
		{
			if (a[i] != a[i + 1])
				cout << a[i] << " ";
		}
		cout << a[n - 1] << " ";
		for (i = 0; i < n - 1; i++)
		{
			if (a[i] == a[i + 1])
				cout << a[i] << " ";
		}
		cout << endl;
	}
}
