#include<bits/stdc++.h>
using namespace std;
class BinaryTreeNode{
public:
int data;
BinaryTreeNode* left;
BinaryTreeNode* right;
BinaryTreeNode(int data){
this->data=data;
left=NULL;
right=NULL;
}
};
BinaryTreeNode* BST_constructor(int* a,int si,int ei){
if(si>ei){
return NULL;
}
int mid=(si+ei)/2;
BinaryTreeNode* root=new BinaryTreeNode(a[mid]);
root->left=BST_constructor(a,si,mid-1);
root->right=BST_constructor(a,mid+1,ei);
return root;
}
void print(BinaryTreeNode* root){
if(root==NULL){
return;
}
cout<data<<" ";
print(root->left);
print(root->right);
}
int main() {
int t;
cin>>t;
while(t–){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
BinaryTreeNode* root=BST_constructor(a,0,n-1);
print(root);
cout<<endl;
}
return 0;
}