#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
int main(void){
	int n;
	cin >> n;
	int k[n][3];
	
	for(int i = 0; i < n; i++) cin >> k[i][0] >> k[i][1] >> k[i][2];
	int we[1 << n];{
	for(int i = 0; i < (1 << n); i++){
		we[i] = 0;
		for(int j = 0; j < n; j++){
			if(!(i & (1 << i))) we[i] += k[i][2] * 20;
		}
	}
	double dp[1 << n][2];
	int ro[1 << n];
	fill(dp, dp + (1 << n), INF); fill(ro, ro + (1 << n), -1);
	dp[0][0] = 0; dp[0][1] = -1; ro[0] = -1;
	for(int i = 0; i < (1 << n); i++){
		if(dp[i][0] != INF){
			for(int j = 0; j < n; j++){
				if(!(i & (1 << i))){
					double cost;
					if(i == 0) cost = k[j][1] / (2000 / 70);
					else if(i + (i << j) == (1 << n - 1){
						cost = abs(k[dp[i][1]][1] - k[j][1]) / (2000 / (70 + we[i]);
						cost += abs(k[n - 1][1] - k[j][1]) / (2000 / (70 + we[1 << n - 1]);
					}
					else cost = abs(k[dp[i][1]][1] - k[j][1]) / (2000 / (70 + we[i]);
					if(dp[i + (i << j)][0] > dp[i][0] + cost){
						dp[i + (i << j)][0] = dp[i][0] + cost;
						dp[i + (i << j)][1] = j;
						ro[i + (i << j)] = i;
					}
				}
			}
		}
	}
	int ans[n], p = 1 << n - 1;
	for(int i = n - 1; i >= 0; i--){
		ans[i] = ro[p];
		p = ro[p];
	}
	cout << ans[0];
	for(int i = 1; i < n; i++) cout << ' ' << ans[i];
	cout << endl;
	return 0;
}
