#include<bits/stdc++.h>
using namespace std;
int min (vector<int>v, int i){
int min = i;
for (int j=i+1; j<v.size(); j++){
if (v[min]>v[j]){
min = j;
}
}
return min;
}
void SelectionSort (vector<int> &v){
int n = v.size();
for (int i=0; i<n; i++){
int m = min (v,i);
swap(v[i],v[m]);
}
}
void print (vector<int>v){
for (int i=0; i<v.size(); i++){
cout<<v[i]<<" ";
}
}
int main(){
//freopen("ip.txt","r",stdin);
//freopen("op.txt","w",stdout);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<int>v(n);
for (int i=0; i<n; i++){
cin>>v[i];
}
SelectionSort (v);
print (v);
cout<<endl;
}
return 0;
}