#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

const int INF = 1 << 29;
const int MAX_N = 15;

double dp[1 << MAX_N][MAX_N];
int route[1 << MAX_N][MAX_N];

int num[MAX_N];
double dis[MAX_N];
double kin[MAX_N];

double calc_dist ( int a, int b )
{
	return fabs(dis[a] - dis[b]);
}

double calc_cost ( int a, int b, double w )
{
	return calc_dist(a, b) / (2000.0 / (70.0 + w));
}
double calc_cost ( int i )
{
	return dis[i] / (2000.0 / 70.0);
}

double calc_wait ( int n, int state )
{
	double res = 0;
	for (int i = 0; i < n; ++i) {
		if (state & (1 << i)) { res += kin[i]; }
	}
	return res;
}

int main ( void )
{
	int n;
	while (cin >> n) {
		for (int i = 0, I = 1 << n; i < I; ++i) {
			fill(dp[i], dp[i]+n, INF);
			fill(route[i], route[i]+n, -1);
		}

		for (int i = 0; i < n; ++i) {
			cin >> num[i] >> dis[i] >> kin[i];
			kin[i] *= 20.0;
			dp[1 << i][i] = calc_cost(i);
			route[1 << i][i] = i;
		}
		for (int s = 0, S = 1 << n; s < S; ++s) {
			for (int i = 0; i < n; ++i) {
				if (dp[s][i] == INF) { continue; }
				for (int j = 0; j < n; ++j) {
					int next = s | (1 << j);
					double tocost = dp[s][i] + calc_cost(i, j, calc_wait(n, s));
					if (dp[next][j] > tocost) {
						dp[next][j] = tocost;
						route[next][j] = i;
					}
				}
			}
		}
		int v = -1, state = (1 << n) - 1;
		for (int i = 0; i < n; ++i) {
			if (v == -1 || dp[state][v] > dp[state][i]) { v = i; }
		}
		vector<int> vs;
		while (state) {
			vs.push_back(num[v]);
			int next = state & ~(1 << v);
			v = route[state][v];
			state = next;
		}
		reverse(vs.begin(), vs.end());
		for (int i = 0, I = vs.size(); i < I; ++i) {
			cout << vs[i] << (i+1 == I ? '\n' : ' ' );
		}
	}
	return 0;
}