#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class KuraInfo{
public:
	int num;
	int dist;
	int weight;
};

double dp[(1<<15)][15];
int dp2[(1<<15)];

int n;
KuraInfo kuras[15];
const int INF=100000000;

double dfs(const int s,const int d,const double sumWeight,const int depth){
	if(s==0)
		return 0;
	double minCost=INF;
	if(d==-1){
		for(int i = 0; i < n; i++){
			if(((s>>i)&1)){
				double ret = dfs(s&~(1<<i),i,sumWeight+kuras[i].weight,depth+1);
				if(minCost>ret){
					dp2[s]=i;
					minCost=min(minCost,ret);
				}
			}
		}
	}
	else{
		if(dp[s][d]!=INF)
			return dp[s][d];
		for(int i = 0; i < n; i++){
			if(((s>>i)&1)){
				double ret = dfs(s&~(1<<i),i,sumWeight+kuras[i].weight,depth+1)+((double)abs(kuras[i].dist-kuras[d].dist)/((double)2000/(70+sumWeight)));
				if(minCost>ret){
					dp2[s]=i;
					minCost=min(minCost,ret);
				}
			}
		}

	}
	dp[s][d]=minCost;
	return dp[s][d];
}

int main(){

	while(cin>>n){
		for(int i = 0; i < n; i++){
			cin>>kuras[i].num>>kuras[i].dist>>kuras[i].weight;
			kuras[i].weight*=20;
		}
		for(int i = 0; i < (1<<15); i++){
			fill(dp[i],dp[i]+15,INF);
		}
		fill(dp2,dp2+(1<<15),INF);
		
		dfs((1<<n)-1,-1,0,0);
		
		int s = (1<<n)-1;
		while(1){
			cout<<kuras[dp2[s]].num;
			s=s&~(1<<dp2[s]);
			if(s==0){
				cout<<endl;
				break;
			}
			else
				cout<<" ";
		}
	}

	return 0;
}