#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
vector<pii>v;
bool compare(pii a,pii b)
{
return (a.first>b.first);
}
int main()
{
int t,n,i,x;
bool f = false;
pii p;
scanf("%d",&t);
while(t--)
{
if(f) puts("");
f = true;
scanf("%d",&n);
v.clear();
for(i=0; i<n; i++)
{
scanf("%d %d",&p.first,&p.second);
x = p.second/p.first;
v.push_back(pii(x,i));
}
sort(v.begin(),v.end(),compare);
for(i=0; i<v.size(); i++)
{
if(i) printf(" ");
printf("%d",v[i].second+1);
}
puts("");
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNkZWZpbmUgcGlpIHBhaXI8aW50LGludD4KdmVjdG9yPHBpaT52OwoKYm9vbCBjb21wYXJlKHBpaSBhLHBpaSBiKQp7CiAgICByZXR1cm4gIChhLmZpcnN0PmIuZmlyc3QpOwp9CgppbnQgbWFpbigpCnsKICAgIGludCB0LG4saSx4OwogICAgYm9vbCBmID0gZmFsc2U7CiAgICBwaWkgcDsKICAgIHNjYW5mKCIlZCIsJnQpOwogICAgd2hpbGUodC0tKQogICAgewogICAgICAgIGlmKGYpICAgcHV0cygiIik7CiAgICAgICAgZiA9IHRydWU7CiAgICAgICAgc2NhbmYoIiVkIiwmbik7CiAgICAgICAgdi5jbGVhcigpOwogICAgICAgIGZvcihpPTA7IGk8bjsgaSsrKQogICAgICAgIHsKICAgICAgICAgICAgc2NhbmYoIiVkICVkIiwmcC5maXJzdCwmcC5zZWNvbmQpOwogICAgICAgICAgICB4ID0gcC5zZWNvbmQvcC5maXJzdDsKICAgICAgICAgICAgdi5wdXNoX2JhY2socGlpKHgsaSkpOwogICAgICAgIH0KICAgICAgICBzb3J0KHYuYmVnaW4oKSx2LmVuZCgpLGNvbXBhcmUpOwogICAgICAgIGZvcihpPTA7IGk8di5zaXplKCk7IGkrKykKICAgICAgICB7CiAgICAgICAgICAgIGlmKGkpICAgcHJpbnRmKCIgIik7CiAgICAgICAgICAgIHByaW50ZigiJWQiLHZbaV0uc2Vjb25kKzEpOwogICAgICAgIH0KICAgICAgICBwdXRzKCIiKTsKICAgIH0KICAgIHJldHVybiAgMDsKfQo=