#include <vector>
#include <iostream>
#include <algorithm>
#ifdef _MSC_VER
#define __builtin_popcount(x) __popcnt(x)
#endif
using namespace std;
struct state {
	vector<int> v;
	long double t;
	int w;
	state() : v(vector<int>()), t(1e10L), w(0) {};
	state(vector<int> v_, long double t_, int w_) : v(v_), t(t_), w(w_) {};
};
bool operator==(const state& s1, const state& s2) {
	return s1.v == s2.v && abs(s1.t - s2.t) < 1e-10L && s1.w == s2.w;
}
bool operator<(const state& s1, const state& s2) {
	return s1.t < s2.t;
}
int n, a[22], b[22], c[22]; state dp[2100000];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];
	for (int i = 0; i < n; i++) dp[1 << i] = state({ i }, 0.0L, c[i]);
	for (int i = 1; i < (1 << n); i++) {
		if (__builtin_popcount(i) > 1) {
			for (int j = 0; j < n; j++) {
				if (i & (1 << j)) {
					state u = dp[i - (1 << j)];
					u.t += 1.0L * abs(b[u.v.back()] - b[j]) * (u.w + 70.0L) / 2000.0L;
					u.w += c[j] * 20;
					u.v.push_back(j);
					dp[i] = min(dp[i], u);
				}
			}
		}
	}
	vector<int> ret = dp[(1 << n) - 1].v;
	for (int i = 0; i < n; i++) printf(i + 1 != n ? "%d " : "%d\n", a[ret[i]]);
	return 0;
}