#include <iostream>
#include <cmath>
#define INF 1e+9
using namespace std;

int main(){
	int n,s[15],d[15],v[15];
	int prev[1 << 15][15];
	double cost[1 << 15][15];
	cin >> n;
	for(int i = 0;i < n;i++) cin >> s[i] >> d[i] >> v[i];
	for(int i = 0;i < 1 << n;i++) for(int j = 0;j < n;j++){
		cost[i][j] = INF;
		prev[i][j] = -1;
	}
	for(int i = 0;i < n;i++){
		cost[1 << i][i] = 0;
	}
	for(int i = 0;i < 1 << n;i++){
		for(int j = 0;j < n;j++){
			if(i >> j & 1){
				int w = -v[j];
				for(int k = 0;k < n;k++){
					if(i >> k & 1) w += v[k];
				}
				for(int k = 0;k < n;k++){
					if(cost[i][j] > cost[i & ~(1 << j)][k] + (double)abs(d[j] - d[k]) / (double)w){
						cost[i][j] = cost[i & ~(1 << j)][k] + (double)abs(d[j] - d[k]) / (double)w;
						prev[i][j] = k;
					}
				}
			}
		}
	}
	int route[15],S = (1 << n) - 1,p;
	double mi = INF;
	for(int i = 0;i < n;i++){
		if(cost[S][i] < mi) {
			mi = cost[S][i];
			p = i;
		}
	}
	route[0] = p;
	for(int i = 1;i < n;i++){
		route[i] = prev[S][p];
		S = S & ~(1 << p);
		p = route[i];
	}
	for(int i = 0;i < n;i++){
		cout << s[route[i]];
		if(i != n - 1) cout << " ";
		else cout << endl;
	}
	return 0;
}