#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
double w[15],d[15],num[15];
int n;

double wei(int bit){
	double ret = 0;
	for(int i = 0 ; i < n ; i++){
		if( bit & (1<<i) )ret += w[i];
	}
	return 20*ret;
}

int main(){
	cin >> n;
	
	vector< vector<double> > dp(1<<15,vector<double>(15,(1<<25))); 
	vector< vector<int> > prevPos(1<<15,vector<int>(15,0)); 
	vector< vector<int> > prevBit(1<<15,vector<int>(15,0));
	
	rep(i,n){
		cin >> num[i] >> d[i] >> w[i];
	}
	
	rep(i,n) dp[(1<<i)][i] = 0.0;
	for(int bit = 1; bit < (1<<n) ; bit++){ // visit info
		for(int i = 0; i < n ; i++){		// prev
			//if( bit & i == 0)continue;
			for(int j = 0; j < n ; j++){	// now
				if(bit & (1<<j) )continue;
				int nBit = bit | (1<<j);
				double newDist = dp[bit][i] + fabs(d[i]-d[j]) * (2000.0 / (70+wei(bit)) );
				
				if(dp[nBit][j] > newDist){
					prevPos[nBit][j] = i;
					prevBit[nBit][j] = bit;
					dp[nBit][j] = newDist;
				}
			}
		}
	}
	double ret = (1<<25);
	vector<int> route;
	int outBit = (1<<n)-1 ,outPos = -1;
	
	rep(i,n)if(ret > dp[outBit][i]){
		outPos = i;
		ret = dp[outBit][i];
	}
	
	route.push_back(outPos);
	while(prevBit[outBit][outPos]){
		int a = prevPos[outBit][outPos] , 
			b = prevBit[outBit][outPos] ;
		outPos = a, outBit = b;
		route.push_back(outPos);
	}
	
	rep(i,route.size()){
		if(i)cout << " ";
		cout << num[route[i]];
	}
	cout << endl;
}