#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

struct Info{
	Info(){
		id = distance = num = 0;
	}
	Info(int arg_id,int arg_distance,int arg_num){
		id = arg_id;
		distance = arg_distance;
		num = arg_num;
	}

	int id,distance,num;
};

int main(){

	int POW[15] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384};
	int N,sum,next_state;
	Info info[15];

	scanf("%d",&N);

	double** dp = new double*[N+1];
	int** pre = new int*[N+1];
	for(int i = 0; i <= N; i++){
		dp[i] = new double[POW[N]];
		pre[i] = new int[POW[N]];
		for(int k = 0; k < POW[N];k++){
			dp[i][k] = BIG_NUM;
			pre[i][k] = -1;
		}
	}


	for(int i = 0; i < N; i++){
		scanf("%d %d %d",&info[i].id,&info[i].distance,&info[i].num);
	}

	if(N == 1){
		printf("0\n");
		return 0;
	}


	for(int i = 0; i < N; i++){
		dp[i][POW[i]] = 0;
	}

	for(int state = 0; state <= POW[N]-2; state++){

		for(int kura = 0; kura < N; kura++){
			if(dp[kura][state] == BIG_NUM)continue;

			sum = 0;
			for(int a = 0; a < N; a++){
				if(state & (1 << a)){
					sum += info[a].num;
				}
			}


			for(int a = 0; a < N; a++){
				if(state & (1 << a)){
					//Do nothing
				}else{
					next_state = state + POW[a];
					if(dp[a][next_state] > dp[kura][state] + (double)abs(info[a].distance-info[kura].distance)/((double)2000/(double)(70+20*sum))){
						dp[a][next_state] = dp[kura][state] + (double)abs(info[a].distance-info[kura].distance)/((double)2000/(double)(70+20*sum));
						pre[a][next_state] = 100000*kura+state;
					}
				}
			}
		}
	}

	double minimum = (double)BIG_NUM;
	int id = 889;

	for(int i = 0; i < N; i++){
		if(minimum > dp[i][POW[N]-1]){
			minimum = dp[i][POW[N]-1];
			id = i;
		}
	}

	stack<int> S;

	S.push(info[id].id);
	int pre_kura = pre[id][POW[N]-1]/100000,pre_state = pre[id][POW[N]-1]%100000;

	while(true){
		S.push(info[pre_kura].id);
		if(pre[pre_kura][pre_state] == -1)break;
		id = pre_kura;
		pre_kura = pre[id][pre_state]/100000;
		pre_state = pre[id][pre_state]%100000;
	}

	printf("%d",S.top());
	S.pop();

	while(!S.empty()){
		printf(" %d",S.top());
		S.pop();
	}

	printf("\n");

	return 0;
}