#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int t ;
cin>>t;
long long arr[1000001];
while(t--)
{
int n;
cin>>n;
double sum=0;
for(int i=0;i<n;i++)
{
cin>>arr[i];
sum+=arr[i];
}
long long c=0;
sort(arr,arr+n);
double avg=sum/n;
if(arr[0]==avg)
{
for(int k=0;k<n;k++)
cout<<arr[k]<<" ";
}
else
{
double sum1=0;
for(int i=0;i<n;i++)
{
if(arr[i]<avg)
{
c++;
sum1+=arr[i];
}
else
{
sum-=sum1;
avg=sum/(n-c);
sum1=0;
if(arr[i]<avg)
{
c++;
}
}
}
// cout<<c;
// cout<<c;
for(int j=c-1;j<n;j++)
{
cout<<arr[j]<<" ";
cout<<"\n";
}
}
}
}
/*
problem cutting trees
long long n,k;
cin>>n>>k;
long long arr[1000001];
for(int i=0;i<n;i++)
cin>>arr[i];
sort(arr,arr+n);
long long freq[1000001]={0};
long long ar[1000001];
long long ary[1000001];
for(int j=0;j<k;j++)
{
freq[arr[j]]++;
}
long long m=0;
for(long long z=1;z<arr[k-1]+1;z++)
{
if(freq[z]>0)
{
ar[m]=z+(freq[z]-1);
ary[m]=ar[m]-freq[z];
m++;
}
}
long long sum1=ar[m-1];
// long long sum1=0;
for(long long a=0;a<m-1;a++)
{
if(ar[a]>ary[a+1])
sum1+=(ar[a]-ary[a+1]);
// cout<<ary[a]<<" ";
}
cout<<sum1;
//cout<<sum1;
}*/
/*long long c=0;
for(int j=0;j<k;j++)
{
if(arr[j]==arr[k-1])
c++;
}
long long sum=arr[k-1]+(c-1);
if(sum-c>=(k-c))
cout<<sum;
else
{
long long m=sum-c;
long long v=(k-c)-m;
cout<<sum+v;
}
/* int freq[1000001]={0};
int y=k-1;
int x=0;
// if(arr[k-1]-arr[0]>=k-1)
// cout<<arr[k-1];
//else
//{
int c=0;
for(int j=0;j<k;j++)
{
if(arr[j]==arr[k-1])
c++;
// freq[arr[j]]++;
}
long long m=arr[k-1]+(c-1);
if(m-y>=arr[0])
cout<<m;
else
{
int z=m-y;
x=arr[0]-z;
cout<<m+x;
}
// long long sum=0;
/* for(int z=1;z<arr[k-1]+1;z++)
{
if(freq[z]>0)
{
sum+=(freq[z]-1);
//cout<<freq[z]<<" ";
}
}*/
//cout<<arr[k-1]+sum;
//}
/*
long long sum=0;
int x=0;
for(int j=0;j<k;j++)
{
sum+=arr[j];
if(arr[j]==arr[j+1])
x=1;
}
long long z=sum;
for(int j=0;j<k;j++)
{
z--;
}
/*if(x==0)
cout<<sum-z-1;
else*/
/*int n,k;
cin>>n>>k;
int arr[1000001];
for(int i=0;i<n;i++)
cin>>arr[i];
sort(arr,arr+n);
int c=0;
int x=0;
int mn=arr[0]+1;
for(int j=1;j<k;j++)
{
if(arr[k-1]==arr[j])
c++;
if(arr[j]!=arr[j+1])
c=0;
if(arr[j]==arr[j+1])
x++;
if(j==k-1)
{
if(x>0)
{
if(mn>arr[k-1])
{
if(c>2)
cout<<mn+1;
else
cout<<mn;
}
else if(mn==arr[k-1])
cout<<mn+(c-1);
else
cout<<arr[k-1];
break;
}
}
else
{
cout<<arr[k-1];
break;
}
mn++;
}
}
/*int n,k;
int arr[1000001];
cin>>n>>k;
for(int i=0;i<n;i++)
cin>>arr[i];
sort(arr,arr+n);
int v=k-1;
int x=arr[k-1];
int z=0;
int c=0;
for(int j=v;j>=0;j--)
{
if(arr[j]<=x)
{
x--;
}
else
{
c=1;
z=arr[j];
//break;
}
}
if(c==0)
cout<<arr[k-1];
else
cout<<(z-x)+arr[k-1];
}*/
Copy