#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
int w[1<<15];
double dp[1<<15][15];
vector<int> path[1<<15][15];
int main() {
	int n,id[15],dist[15],value[15];
	scanf("%d",&n);
	for(int i=0;i<n;i++) {
		scanf("%d %d %d",&id[i],&dist[i],&value[i]);
	}
	for(int i=0;i<(1<<n);i++) {
		int sum=0,cnt=0;
		for(int j=1;j<(1<<n);j<<=1,cnt++) {
			if(i&j) sum+=value[cnt];
		}
		w[i]=sum*20;
	}
	fill((double*)dp,(double*)(dp+(1<<15)),1e100);
	for(int i=0;i<n;i++) {
		dp[1<<i][i]=0;
		path[1<<i][i].push_back(i);
	}
	for(int i=0;i<(1<<n);i++) {
		double v=2000/(70.0+w[i]);
		for(int j=0;j<n;j++) {
			if((i&(1<<j))==0) continue;
			for(int k=0;k<n;k++) {
				if(i&(1<<k)) continue;
				double cost=abs(dist[j]-dist[k])/v;
				if(dp[i|(1<<k)][k]>dp[i][j]+cost) {
					dp[i|(1<<k)][k]=dp[i][j]+cost;
					path[i|(1<<k)][k]=path[i][j];
					path[i|(1<<k)][k].push_back(k);
				}
			}
		}
	}
	double min_t=1e100;
	vector<int> ans;
	for(int i=0;i<n;i++) {
		if(min_t>dp[(1<<n)-1][i]) {
			min_t=dp[(1<<n)-1][i];
			ans=path[(1<<n)-1][i];
		}
	}
	for(int i=0;i<ans.size()-1;i++) {
		printf("%d ",id[ans[i]]);
	}
	printf("%d\n",id[ans[ans.size()-1]]);
}