#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

double dp[1 << 15][15];
int prv[1 << 15][15], c[15], d[15], v[15];
int main() {
	int n; scanf("%d", &n);
	rep(i, n)scanf("%d%d%d", &c[i], &d[i], &v[i]), v[i] *= 20;
	fill(dp[0], dp[1 << n], INF);
	rep(i, n)dp[1 << i][i] = 0;
	rep(i, 1 << n)rep(j, n) {
		int w = 0;
		rep(k, n) {
			if (i >> k & 1)w += v[k];
		}
		rep(k, n) {
			if (i >> k & 1)continue;
			double cost = dp[i][j] + abs(d[j] - d[k]) / (2000. / (70 + w));
			if (dp[i | 1 << k][k] > cost) {
				dp[i | 1 << k][k] = cost; prv[i | 1 << k][k] = j;
			}
		}
	}
	int Min = INF, id;
	rep(i, n) {
		if (Min > dp[(1 << n) - 1][i]) {
			Min = dp[(1 << n) - 1][i]; id = i;
		}
	}
	vector<int>v;
	int s = (1 << n) - 1;
	while (s) {
		v.push_back(c[id]);
		int k = id;
		id = prv[s][id];
		s ^= 1 << k;
	}
	reverse(v.begin(), v.end());
	rep(i, v.size()) {
		if (i)printf(" ");
		printf("%d", v[i]);
	}
	printf("\n");
}