#include<bits/stdc++.h>
using namespace std;
class node{
public:
int data;
nodeleft;
noderight;
node(int d){
data=d;
left=NULL;
right=NULL;
}
};
node* buildBST(int a,int n,int s,int e){
if(s>e){
return NULL ;
}
int mid=(s+e)/2;
noderoot= new node(a[mid]);
root->left=buildBST(a,n-1,s,mid-1);
root->right=buildBST(a,n-1,mid+1,e);
return root;
}
void printBST(node*root){
if(root==NULL){
return ;
}
cout<data<<" ";
printBST(root->left);
printBST(root->right);
}
int main(){
int t;
cin>>t;
while(t–){
int n;
cin>>n;
int a[n]={0};
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
node*root=buildBST(a,n,0,n-1);
printBST(root);
cout<<endl;
}
}