#include <iostream>
#include <stdlib.h>
using namespace std;
int main(){
	int n,number[20],distance[20],vi[20],save_vi[20],save_distance[20];
	int vi_number[20],distance_number[20];
	cin >>n;
	for(int i=0 ; i<n ; i++ ){
		cin >> number[i] >> distance[i] >> vi[i];
		save_vi[i]=vi[i];
		save_distance[i]=distance[i];
		vi_number[i]=distance_number[i]=i;
	}
	for(int i=0 ; i<n ; i++ ){
		for(int j=i+1 ; j<n ; j++ ){
			if(save_vi[i]>save_vi[j]){
				swap(save_vi[i],save_vi[j]);
				swap(vi_number[i],vi_number[j]);
			}
			if(save_distance[i]>save_distance[j]){
				swap(save_distance[i],save_distance[j]);
				swap(distance_number[i],distance_number[j]);
			}
		}
	}
	double num_vi=0;
	double ss=0;
	for(int i=0 ; i<n-1 ; i++ ){
		num_vi+=vi[vi_number[i]];
//		cout << vi_number[i] << " fdsaf "<< vi[vi_number[i]] << endl;
		double tmp=2000/(70+(num_vi*20));
		ss+=(abs(distance[vi_number[i]]-distance[vi_number[i+1]])/tmp);
//		cout << vi_number[i]- vi_number[i+1] <<" "<< tmp<< endl;
//		cout << abs(distance[vi_number[i]]-distance[vi_number[i+1]]) << endl;
	}
	double num_distance=0;
	double sss=0;
	for(int i=0 ; i<n-1 ; i++ ){
		num_distance+=vi[distance_number[i]];
//		cout << vi[distance_number[i]] <<" fsa "<< distance_number[i] << endl;
		double tmp=2000/(70+(num_distance*20));
//		cout << "fsdfasfdf fsd " << double(2000/num_distance) << endl;
//		cout << tmp << "numnum " << tmp << endl;
		sss+=(abs(distance[distance_number[i]]-distance[distance_number[i+1]])/tmp);
//		cout << sss << endl;
	}
	if(ss<sss){
		for(int i=0 ; i<n ; i++ ){
			cout << number[vi_number[i]] <<" ";
		}
		cout << endl;
		return 0;
	}
	else{
		for(int i=0 ; i<n ; i++ ){
			cout << number[distance_number[i]] <<" ";
		}
		cout << endl;
		return 0;
	}
}