#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

int N;
pair<ld,vector<int>> memo[1 << 15][20];
struct kura {
	int id;
	int d;
	ld w;
};
vector<kura>ks;
pair<ld,vector<int>> getans(bitset<15>used, int now,ld noww) {
	if (used.count() == N) {
		memo[used.to_ulong()][now] = make_pair(0,vector<int>(1,now));
	}
	else {
		if (memo[used.to_ulong()][now].first < -0.5) {
			pair<ld, vector<int>>ans=make_pair(1e18,vector<int>());
			for (int next = 0; next < N; ++next) {
				if (used[next])continue;
				used[next] = true;
				ld nextw = noww + ks[next].w;
				ld dis = abs(ks[now].d - ks[next].d);
				ld nextspeed = 2000.l / (70 + nextw);
				auto p = getans(used, next, nextw);
				ld nexttime = dis / (2000.l/(70+noww)) + p.first;
				auto v = p.second;
				v.push_back(now);
				ans = min(ans, make_pair(nexttime, v));
				used[next] = false;
			}
			memo[used.to_ulong()][now] = ans;
		}
	}
	return memo[used.to_ulong()][now];
}

int main() {
	cin >> N;
	for (int i = 0; i < (1 << 15); ++i) {
		for (int j = 0; j < 20; ++j) {
			memo[i][j] = make_pair(-1,vector<int>());
		}
	}
	for (int i = 0; i < N; ++i) {
		int s, d, v; cin >> s >> d >> v;
		ld w = v * 20;
		ks.push_back(kura{ s,d,w });
	}
	ks.push_back(kura{ -1,0,0 });
	bitset<15>bs;
	auto ans = getans(bs, N, 0);
	reverse(ans.second.begin(), ans.second.end());
	for (int i = 1; i < int(ans.second.size()); ++i) {
		cout << ks[ans.second[i]].id;
		if (i == int(ans.second.size()) - 1)cout << endl;
		else cout << " ";
	}
	return 0;
}