Untitled

mail@pastecode.io avatarunknown
plain_text
a month ago
737 B
2
Indexable
Never
#include <bits/stdc++.h>
#define wt int __; cin>>__; while(__--)
#define s(x) int32_t(x.size())
#define r(x, ns) for(auto &x : ns)
#define f(i, s, t) for(int i = s; i < t; ++i)

using namespace std;

typedef string ss;
typedef long double dd;
typedef long long ll;

const int MAX = 1005;

int ns[MAX];
map<int, int> frq;

int32_t main() {
  cin.tie(nullptr)->sync_with_stdio(0);

  wt {
    frq.clear();
    int n; cin>>n;
    f(i,0,(n*(n-1))/2) {
      cin>>ns[i];
      frq[ns[i]]++;
    }
    int cur = n-1;
    r(v, frq) {
      while(v.second > 0 && cur > 0 && v.second >= cur) {
        cout<<v.first<<' ';
        v.second -= cur;
        --cur;
      }
    }
    cout<<int(1e9)<<'\n';
  }
}