#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(n) n.begin(),n.end()
#define d(a,b) abs(a-b)

int main(){
	int n,a,b,c;

	double dp[1<<15][15];
	vector<int> path[1<<15][15];
	int num[15],w[15],d[15];
	
	cin >> n;

	rep(i,(1<<15) ){
		fill(dp[i], dp[i]+15	, (1<<21) );
	}
	
	rep(i,15)dp[0][i] = 0;
	
	rep(i,n){
		cin >> a >> b >> c;
		num[i] = a, d[i] = b, w[i] = c;
	}
	
	for(int bit=0; bit < (1<<n) ; bit++){
		for(int i=0;i<n;i++){
			if( ( bit & (1<<i) ) == 0 )continue;
			for(int j=0;j<n;j++){
				double cst = dp[bit][i] + abs(d[j]-d[i])/(2000.0 / (w[i] + 70));
				if( dp[bit|(1<<j)][j] > cst){
					dp[bit|(1<<j)][j] = cst;
					path[bit|(1<<j)][j] = path[bit][i];
					path[bit|(1<<j)][j].push_back(i);
				}
			}
		}
	}
	vector<int> ret;int M = (1<<21);
	rep(i,n){
		if( dp[(1<<n)-1][i] < M){
			ret = path[(1<<n)-1][i];
			M = dp[(1<<n)-1][i];
		}
	}
	rep(i,ret.size()){
		cout << (i?" ":"") << num[ret[i]];
	}cout << endl;
}
	