#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

typedef struct {
	int no;
	int dist;
	int money;
} Store;

Store data[16];
double dp[1 << 16][16];
int n;

int popCount(int n)
{
	return (n ? (n & 1) + popCount(n >> 1) : 0);
}

double getTime(int S, int v, int idx, int *p) //S:訪れた頂点の集合 v:今いる頂点
{
	if (~v && dp[S][v] >= 0){
		return (dp[S][v]);
	}
	
	if (S == (1 << n) - 1){
		return (0);
	}
	
	int sumMoney = 0;
	for (int i = 0; i < n; i++){
		if ((S >> i) & 1) sumMoney += data[i].money;
	}
	
	
	double minTime = -1;
	for (int i = 0; i < n; i++){
		if (!((S >> i) & 1)){
			int next[16];
			for (int i = 0; i < idx; i++) next[i] = p[i];
			next[idx] = i;
			int dx = abs((~v ? data[v].dist : 0) - data[i].dist);
			double nv = 2000 * 1.0 / (70 + 20 * sumMoney);
			double nowTime = dx / nv + getTime(S | (1 << i), i, idx + 1, next);
			if (minTime == -1) minTime = nowTime;
			else minTime = min(minTime, nowTime);
			if (minTime == nowTime){
				for (int i = 0; i < n; i++) p[i] = next[i];
			}
		}
	}
	
	return (dp[S][v] = minTime);
}

int main()
{
	int route[16];
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++){
		scanf("%d %d %d", &data[i].no, &data[i].dist, &data[i].money);
	}
	
	for (int i = 0; i < 1 << 16; i++){
		for (int j = 0; j < 16; j++){
			dp[i][j] = -1;
		}
	}
	
	getTime(0, -1, 0, route);
	
	for (int i = 0; i < n; i++){
		printf("%d%c", data[route[i]].no, i == n - 1 ? '\n' : ' ');
	}
	
	return (0);
}