#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	const int MAXN = 15, MAXBITN = 1 << MAXN;
	
	int n, bitn;
	int num[MAXN], dist[MAXN], money[MAXN];
	
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
		scanf("%d%d%d", &num[i], &dist[i], &money[i]);
	bitn = 1 << n;
		
	static double dp[MAXBITN][MAXN] = { 0 };
	static double speed[MAXBITN] = { 0 };
	static int his[MAXBITN][MAXN] = { 0 };
	
	for(int i = 1; i < bitn; ++i) {
	
		int prev = 0;
		while(!(i & (1 << prev))) ++prev;
		speed[i] = speed[i & ~(1 << prev)] + money[prev] * 20;
	}
	
	for(int i = 0; i < bitn; ++i) {
		speed[i] = 200.0 / (speed[i] + 70);
		for(int j = 0; j < n; ++j) {
			his[i][j] = -1;
			dp[i][j] = 1e10;
		}
	}
	
	for(int i = 0; i < n; ++i)
		dp[0][i] = dp[1 << i][i] = 0;
		
	for(int i = 1; i < bitn; ++i) {
		for(int j = 0; j < n; ++j) {
			
			int prev = i & ~(1 << j);
			
			for(int k = 0; k < n; ++k) {
				
				if(prev & (1 << k)) {
					
					double time = abs(dist[j] - dist[k]) / speed[prev];
					double sum = dp[prev][k] + time;
					//printf("[Debug] %f vs %f\n", dp[i][j], sum);
					if(dp[i][j] > sum) {
						his[i][j] = k;
						dp[i][j] = sum;
					}
				}
			}
		}
	}
	
	int idx = 0, ptr = n - 1;
	int mask = (1 << n) - 1;
	int ans[MAXN];
	
	for(int i = 0; i < n; ++i)
		idx = dp[mask][idx] > dp[mask][i] ? i : idx;
		
	ans[ptr--] = idx;
	while(his[mask][idx] != -1) {
		mask = mask & ~(1 << idx);
		idx = his[mask | (1 << idx)][idx];
		ans[ptr--] = idx;
	}
	
	for(int i = 0; i < n; ++i)
		printf("%d%c", num[ans[i]], i < n - 1 ? ' ' : '\n');
	
	return 0;
}