/*
 * main.cpp
 *
 *  Created on: Sep 18, 2008
 *      Author: Chris
 */

#include <cstdio>
#include <list>

using namespace std;


int main() {
	int num_cases, num_jobs;
	scanf("%d", &num_cases);

	list<pair<double, int> > jobs;

	for (int i = 0; i < num_cases; i++) {
		if (i != 0) printf("\n");
		scanf("%d", &num_jobs);
		jobs.clear();
		for (int j = 0; j < num_jobs; j++) {
			int t, f;
			scanf("%d %d", &t, &f);
			double cost = 1.0 * f / t;
			pair<double, int> n(cost, j + 1);
			list<pair<double, int> >::iterator iter = jobs.begin();
			while (iter != jobs.end() && iter->first + 0.000002 >= cost) iter++;
			jobs.insert(iter, n);
		}

		for (list<pair<double, int> >::iterator iter = jobs.begin(); iter != jobs.end(); iter++) {
			if (iter != jobs.begin()) printf(" ");
			printf("%d", iter->second);
		}
		printf("\n");
	}
	return 0;
}

