sicily 1738. Get Ready?
// Penalty是不用管的。。。
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
struct node
{
int id,s;
bool operator>(const node& o)const
{
return s>o.s;
}
}ans[1000000];
int main()
{
int cases,n,t,s,p;
cin>>cases;
while(cases--)
{
cin>>n;
for(int i=0;i<n;++i)
{
cin>>t>>s>>p;
ans[i].id=t;ans[i].s=s;
}
sort(ans,ans+n,greater<node>());
for(int i=0;i<n-1;++i)
cout<<ans[i].id<<" ";
cout<<ans[n-1].id<<endl;
}
return 0;
}