#include <bits/stdc++.h>
#define ll long long
using namespace std;



int main() {
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
 cout.tie(NULL);
 ll t;
 cin>>t;
 while(t--){
  int n;
  cin>>n;
  int arr[n];
  vector<int> x;
  for(int i=0; i<n; i++) cin>>arr[i];
  sort(arr,arr+n);
  cout<<arr[0]<<" ";
  for(int i=1; i<n; i++){
    if(arr[i]!=arr[i-1]) cout<<arr[i]<<" ";
    else x.push_back(arr[i]);
  }
  for(int i=0; i<x.size(); i++){
    cout<<x[i]<<" ";
  }
  cout<<"\n";
}
 return 0;
}
