#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<map>
#include<stack>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<sstream>


#define reps(i,f,n) for(int i = f; i < int(n); i++)
#define rep(i,n) reps(i,0,n)

using namespace std;

const int INF = 1000000000;

int dis[16][16];
int n;
double anst;
int ans[20];
int temp[20];
double memo[1<<16];
int z[16];

void dfs(int s, int now, double t, int w, int cnt){
	memo[s] = t;
	if(cnt == n){
		if(anst > t){
//			printf("%lf > %lf\n", anst, t);
			rep(i,n){
//				printf("%3d ", temp[i]);
				ans[i] = temp[i];
			}
			anst = t;
//			puts("");
		}
		return;
	}
	rep(i,n){
		if( !(s&(1<<i)) ){
			temp[cnt] = i;
			if(memo[s|(1<<i)] > INF-1 || memo[s|(1<<i)] > t+(dis[now][i]/(2000/(70.+w)))){
				dfs(s|(1<<i), i, t+(dis[now][i]/(2000/(70.+w))), w + z[i], cnt+1);
			}
		}
	}
}
	

int main(void){
	
	int id[16];
	int dis_c[16];	
	
	scanf("%d", &n);
	rep(i, 1<<16)memo[i] = INF;
	rep(i,n){
		scanf("%d %d %d", &id[i], &dis_c[i], &z[i]);
		z[i]*=20;
	}
	anst = INF;
	rep(i,16)rep(j,16)dis[i][j] = INF;
	rep(i,n)rep(j,n) dis[i][j] = dis[j][i] = abs(dis_c[i] -dis_c[j]);
	
	rep(i,n){
		temp[0] = i;
		dfs(1<<i, i, 0, z[i], 1);
	}
	printf("%d", id[ans[0]]);
	reps(i,1,n){
		printf(" %d", id[ans[i]]);
	}
	puts("");
	
	
	return 0;
}