#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

double dp[1<<15][15];
int prevBit[1<<15][15];
int prevPos[1<<15][15];
int num[15], dist[15], cnt[15];

int main() {
	int n;
	cin >> n;
	REP(i, n) scanf("%d %d %d", &num[i], &dist[i], &cnt[i]);
	
	fill(dp[0], dp[1<<15], INF);
	REP(i, n) dp[1<<i][i] = 0.0;
	
	REP(i, 1<<n) REP(j, n) {
		if (dp[i][j] == INF) continue;
		
		int weight = 0;
		REP(k, n) if ((i >> k) & 1) weight += cnt[k] * 20;
		double speed = 2000.0 / (70.0 + weight);
		
		REP(k, n) if (((i >> k) & 1) == 0) {
			int next = i | (1 << k);
			double cost = abs(dist[j] - dist[k]) / speed;
			if (dp[next][k] > dp[i][j] + cost) {
				prevBit[next][k] = i;
				prevPos[next][k] = j;
				dp[next][k] = dp[i][j] + cost;
			}
		}
	}
	
	pair<double, int> m = make_pair(INF, -1);
	REP(i, n) m = min(m, make_pair(dp[(1<<n)-1][i], i));
	int nowPos = m.second;
	int nowBit = (1 << n) - 1;
	vector<int> ans;
		
	while (nowBit > 0) {
		ans.push_back(num[nowPos]);
		int nextBit = prevBit[nowBit][nowPos];
		int nextPos = prevPos[nowBit][nowPos];
		
		nowBit = nextBit;
		nowPos = nextPos;
	}
	
	reverse(ans.begin(), ans.end());
	REP(i, ans.size()) printf("%d%c", ans[i], i == ans.size() - 1 ? '\n' : ' ');
	return 0;
}