#include <iostream>
#include <algorithm>
using namespace std;
int removeDuplicates(int arr[], int n) 
{ 
    if (n==0 || n==1) 
        return n; 
  
    int temp[n]; 
  
    int j = 0; 
    for (int i=0; i<n-1; i++) 

        if (arr[i] != arr[i+1]) 
            temp[j++] = arr[i]; 
  
    // Store the last element as whether 
    // it is unique or repeated, it hasn't 
    // stored previously 
    temp[j++] = arr[n-1]; 
  
    // Modify original array 
    for (int i=0; i<j; i++) 
        arr[i] = temp[i]; 
  
    return j; 
} 
int main() {
    int t;
    cin>>t;
    while(t-->0){
        int n,m;
        cin>>n;
        int a[n],b[n];
        for(int i=0;i<n;i++){
            cin>>a[i];
            b[i]=a[i];
        }
        sort(a,a+n);
        sort(b,b+n);
        m=removeDuplicates(a, n) ;
        for(int i=0;i<m;i++){
            cout<<a[i]<<" ";
        }
        for(int i=0;i<n && n>1;i++){
            if(b[i]==b[i+1]){
                cout<<b[i+1]<<" ";
            }
        }
        cout<<endl;
    }
    return 0;
}
