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

using namespace std;

// ????????????????????????

#define MAX_N 15
#define INF 1e9

struct Prev {
	int n, state;
	Prev(int n, int state) : n(n), state(state) {}
	Prev() {}
};

double dp[MAX_N][1 << MAX_N]; //dp[???????????????][??????????????£??????] = ?§??????????(double)
Prev pre[MAX_N][1 << MAX_N];

struct Data {
	int n, x, w;
	Data(int n, int x, int num) : n(n), x(x) {
		w = num * 20;
	}
};

// ??????2,000???(70+w)????????????

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < (1 << MAX_N); ++j) {
			dp[i][j] = INF;
			pre[i][1 << i] = Prev(i, 0);
		}
	}

	vector<Data> data;
	for (int i = 0; i < n; ++i) {
		int n, x, num; cin >> n >> x >> num;
		data.push_back( Data(n, x, num) );
	}

	for (int i = 0; i < n; ++i) {
		double v = 2000.0 / 70;
		dp[i][1 << i] = data[i].x / v;
	}

	// ?????¢?????????
	int dist[MAX_N][MAX_N];
	for (int from = 0; from < n; ++from) {
		for (int to = 0; to < n; ++to) {
			if (from == to) dist[from][to] = 0;
			else dist[from][to] = dist[to][from] = abs(data[from].x - data[to].x);
		}
	}

	for (int t = 0; t < n; ++t) {
		for (int from = 0; from < n; ++from) {
			for (int prev = 0; prev < (1 << MAX_N); ++prev) {
				if (dp[from][prev] == INF) continue; // ???????¨??????????????????¶???

				int w = 0;
				for (int i = 0; i < n; ++i) {
					if (prev & (1 << i)) {
						w += data[i].w;
					}
				}
				double v = 2000.0/(70+w);

				for (int to = 0; to < n; ++to) {
					if (prev & (1 << to)) continue; // ??¢????¨???????
					dp[to][prev | (1 << to)] = dp[from][prev] + dist[from][to] / v;
					pre[to][prev | (1 << to)] = Prev( from, prev );
				}
			}
		}
	}

	int aPrev = 0;
	for (int i = 0; i < n; ++i) aPrev |= 1 << i;

	double aTime = INF;
	int aid = -1;
	for (int i = 0; i < n; ++i) {
		if ( dp[i][aPrev] < aTime ) {
			aTime = dp[i][aPrev];
			aid = i;
		}
	}

	Prev now = Prev(aid, aPrev);
	vector<int> ans; ans.push_back(aid);
	while (1) {
		Prev prev = pre[now.n][now.state];

		// ????????????
		if (prev.n == now.n) break;

		ans.push_back(prev.n);
		now = prev;
	}

	reverse( ans.begin(), ans.end() );

	for (int i = 0; i < ans.size(); ++i) {
		if (i) cout << " ";
		cout << data[ans[i]].n;
	}
	cout << endl;
}