#include <iostream>
#include <algorithm>
#include <utility>
#include <cmath>
#include <stack>
using namespace std;

#define val first
#define prev second
#define INF 10000000000
#define EPS 1e-6

static const int N_MAX = 15;
double dptab[1 << N_MAX][N_MAX];
int N;
int dist[N_MAX][N_MAX];
int baggage[N_MAX];

double velocity(int status) {
	int w = 0;
	for(int i = 0; i < N; i++) {
		if(status & (1 << i))
			w += baggage[i];
	}

	return 2000.0 / (70 + 20*w);
}

double bitdp(int status, int current) {
	/* debug
	cout << hex << status << endl;
	// */

	if(dptab[status][current] != INF) {
		return dptab[status][current];
	}
	for(int i = 0; i < N; i++) {
		if(status & (1 << i)) {
			dptab[status][current] = min(dptab[status][current], bitdp(status & ~(1 << current), i) + dist[i][current] / velocity(status & ~(1 << current)));
		}
	}
	return dptab[status][current];
}

int main() {
	// init
	for(int i = 0; i < (1 << N_MAX); i++)
		for(int j = 0; j < N_MAX; j++)
			dptab[i][j] = INF;

	// input
	cin >> N;

	int in[N_MAX][3];
	for(int i = 0; i < N; i++) {
		cin >> in[i][0] >> in[i][1] >> in[i][2];
	}

	for(int i = 0; i < N; i++) {
		for(int j = 0; j < N; j++) {
			dist[i][j] = dist[j][i] = abs(in[i][1] - in[j][1]);
		}
		baggage[i] = in[i][2];
	}

	// init
	for(int i = 0; i < N; i++)
		dptab[1 << i][i] = 0;

	double ans = INF;
	int last = -1;
	for(int i = 0; i < N; i++) {
		double tmp = bitdp((1 << N) - 1,i);
		if(ans > tmp) {
			ans = tmp;
			last = i;
		}
	}

	if(last < 0) {
		abort();
	}
	//cout << "ans:" << ans << endl;

	stack<int> path;
	int flg = (1 << N) - 1;
	while(flg) {
		path.push(in[last][0]);
		flg &= ~(1 << last);
		for(int i = 0; i < N; i++) {
			if(flg & (1 << i)) {
				double cost;
				cost = dist[i][last] / velocity(flg);

				if(fabs(cost + bitdp(flg, i) - bitdp(flg | (1 << last), last)) < EPS) {
					last = i;
					break;
				}
			}
		}
	}

	while(path.size() > 1){
		cout << path.top() << " ";
		path.pop();
	}
	cout << path.top() << endl;

	return 0;
}