#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
#define N (1000005)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(v) ((int)(v).size())
#define ed(v) v.end()
#define contains(v,i) (v.find(i)!=v.end())
#define forn(i,a,b) for(ll i = a; i < b; i++)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sq(v) ((a)*(a))
#define cb(v) ((a)*(a)*(a))


 
typedef long long int ll;
typedef long double ld;
typedef pair <ll,ll> pll;
typedef vector<ll> vi;
typedef map<ll,ll> mll;



 
int main(){
    
    fast
    
    ll t;
    cin >> t;
    forn(i, 0, t){
      ll n;
      cin >> n;
      vi a(n);
      forn(i, 0, n){
        cin >> a[i];
      }
      sort(all(a));
      vi dupes;
      forn(i, 0, n){
        if(i > 0 && a[i] == a[i-1]){
          dupes.pb(a[i]);
        } else {
          cout << a[i] << " ";
        }
      }
      for(auto d : dupes){
        cout << d << " ";
      }
      cout << endl;
    
    }

   
    return 0;
}
