#include "bits/stdc++.h"
#ifdef PRINTERS
#include "printers.hpp"
using namespace printers;
#define tr(a) cerr<<#a<<": "<<a<<endl;
#else
#define tr(a)
#endif
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define all(a) (a).begin(),(a).end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define hell 1000000007
#define endl '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define delta idx
#define gamma temp
using namespace std;
vi delta;
map<int,int>gamma;
int n;
bool recurse(int u){
if(u==n-2){
sort(all(idx));
for(auto j:idx)cout<<j<<" ";
cout<<endl;
return 1;
}
{
bool isGood=1;
idx.pb(temp.rbegin()->F);
vi erased;
rep(k,0,u+2){
auto it=temp.find(abs(idx[k]-idx.back()));
if(it==temp.end()){
isGood=0;
break;
}
else{
erased.pb(it->F);
it->S--;
if(it->S==0)temp.erase(it);
}
}
if(isGood and recurse(u+1))return 1;
idx.pop_back();
for(auto i:erased)temp[i]++;
}
{
bool isGood=1;
idx.pb(idx[1]-temp.rbegin()->F);
vi erased;
rep(k,0,u+2){
auto it=temp.find(abs(idx[k]-idx.back()));
if(it==temp.end()){
isGood=0;
break;
}
else{
erased.pb(it->F);
it->S--;
if(it->S==0)temp.erase(it);
}
}
if(isGood and recurse(u+1))return 1;
idx.pop_back();
for(auto i:erased)temp[i]++;
}
return 0;
}
void solve(){
gamma.clear();
delta.clear();
cin>>n;
rep(i,0,(n*(n-1))/2){
int alpha;
cin>>alpha;
gamma[alpha]++;
}
if(n==2){
cout<<0<<" "<<gamma.begin()->F<<endl;
return;
}
delta.pb(0);
delta.pb(gamma.rbegin()->F);
gamma.rbegin()->S--;
if(gamma.rbegin()->S==0){
gamma.erase(gamma.rbegin()->F);
}
assert(recurse(0));
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t=1;
cin>>t;
while(t--){
solve();
}
return 0;
}
I2luY2x1ZGUgImJpdHMvc3RkYysrLmgiCiNpZmRl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gdmkgZXJhc2VkOwogICAgICAgIHJlcChrLDAsdSsyKXsKICAgICAgICAgICAgYXV0byBpdD10ZW1wLmZpbmQoYWJzKGlkeFtrXS1pZHguYmFjaygpKSk7CiAgICAgICAgICAgIGlmKGl0PT10ZW1wLmVuZCgpKXsKICAgICAgICAgICAgICAgIGlzR29vZD0wOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZXsKICAgICAgICAgICAgICAgIGVyYXNlZC5wYihpdC0+Rik7CiAgICAgICAgICAgICAgICBpdC0+Uy0tOwogICAgICAgICAgICAgICAgaWYoaXQtPlM9PTApdGVtcC5lcmFzZShpdCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYoaXNHb29kIGFuZCByZWN1cnNlKHUrMSkpcmV0dXJuIDE7CiAgICAgICAgaWR4LnBvcF9iYWNrKCk7CiAgICAgICAgZm9yKGF1dG8gaTplcmFzZWQpdGVtcFtpXSsrOwogICAgfQogICAgewogICAgICAgIGJvb2wgaXNHb29kPTE7CiAgICAgICAgaWR4LnBiKGlkeFsxXS10ZW1wLnJiZWdpbigpLT5GKTsKICAgICAgICB2aSBlcmFzZWQ7CiAgICAgICAgcmVwKGssMCx1KzIpewogICAgICAgICAgICBhdXRvIGl0PXRlbXAuZmluZChhYnMoaWR4W2tdLWlkeC5iYWNrKCkpKTsKICAgICAgICAgICAgaWYoaXQ9PXRlbXAuZW5kKCkpewogICAgICAgICAgICAgICAgaXNHb29kPTA7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlewogICAgICAgICAgICAgICAgZXJhc2VkLnBiKGl0LT5GKTsKICAgICAgICAgICAgICAgIGl0LT5TLS07CiAgICAgICAgICAgICAgICBpZihpdC0+Uz09MCl0ZW1wLmVyYXNlKGl0KTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZihpc0dvb2QgYW5kIHJlY3Vyc2UodSsxKSlyZXR1cm4gMTsKICAgICAgICBpZHgucG9wX2JhY2soKTsKICAgICAgICBmb3IoYXV0byBpOmVyYXNlZCl0ZW1wW2ldKys7CiAgICB9CiAgICByZXR1cm4gMDsKfQp2b2lkIHNvbHZlKCl7CiAgICBnYW1tYS5jbGVhcigpOwogICAgZGVsdGEuY2xlYXIoKTsKICAgIGNpbj4+bjsKICAgIHJlcChpLDAsKG4qKG4tMSkpLzIpewogICAgICAgIGludCBhbHBoYTsKICAgICAgICBjaW4+PmFscGhhOwogICAgICAgIGdhbW1hW2FscGhhXSsrOwogICAgfQogICAgaWYobj09Mil7CiAgICAgICAgY291dDw8MDw8IiAiPDxnYW1tYS5iZWdpbigpLT5GPDxlbmRsOwogICAgICAgIHJldHVybjsKICAgIH0KICAgIGRlbHRhLnBiKDApOwogICAgZGVsdGEucGIoZ2FtbWEucmJlZ2luKCktPkYpOwogICAgZ2FtbWEucmJlZ2luKCktPlMtLTsKICAgIGlmKGdhbW1hLnJiZWdpbigpLT5TPT0wKXsKICAgICAgICBnYW1tYS5lcmFzZShnYW1tYS5yYmVnaW4oKS0+Rik7CiAgICB9CiAgICBhc3NlcnQocmVjdXJzZSgwKSk7Cn0KCnNpZ25lZCBtYWluKCl7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgIGNpbi50aWUoMCk7CiAgICBjb3V0LnRpZSgwKTsKICAgIGludCB0PTE7CiAgICBjaW4+PnQ7CiAgICB3aGlsZSh0LS0pewogICAgICAgIHNvbHZlKCk7CiAgICB9CiAgICByZXR1cm4gMDsKfQ==