#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
#define pb push_back
void print_queue(priority_queue<ll> q) {
while(!q.empty()) {
cout << q.top()*-1 << ' ';
q.pop();
}
cout << '\n';
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(NULL);
int t;
cin >> t;
while(t--) {
int n;
long double sum=0,average;
priority_queue<ll> priorities;
cin >> n;
for(int i=0; i<n; i++) {
ll x;
cin >> x;
priorities.push(-x);
sum+=x;
}
average=sum/priorities.size();
while(true) {
if(-priorities.top()<average) {
sum+=priorities.top();
priorities.pop();
average=sum/priorities.size();
if(priorities.empty()) {
cout << -1;
break;
}
} else {
print_queue(priorities);
break;
}
}
}
return 0;
}
Copy