#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
//#define int long long
using namespace std;

int n;
int kura_num[15], dis[15], hako_kosu[15];
double dp[1 << 15][15];
int next[1 << 15][15];

double rec(int S, int v) {
	//printf("rec S = %d, v = %d\n", S, v);

	if (dp[S][v] >= 0.0) {
		return dp[S][v];
	}

	if (S == (1 << n) - 1) {
		return dp[S][v] = 0.0;
	}

	int kosu = 0;
	for (int u = 0; u < n; u++)
		if (S >> u & 1) kosu += hako_kosu[u];

	double res = DBL_MAX;
	for (int u = 0; u < n; u++) {
		if (!(S >> u & 1)) {
			double cost = (double)(fabs(dis[u] - dis[v]) / (2000.0 / (70.0 + 20.0 * kosu)));
			//printf("cost = %.5f\n", cost);
			double temp = rec(S | 1 << u, u) + cost;
			if (temp < res)
			{
				res = temp;
				next[S][v] = u;
			}
		}
	}

	return dp[S][v] = res;
}

signed main()
{
	cin >> n;
	rep(i,n) cin >> kura_num[i] >> dis[i] >> hako_kosu[i];
	
	rep(i,1<<15) rep(j,15) dp[i][j] = -1.0;	//??????????????????rec?????????????????????????????????????????????

	int first_v;
	double ans = DBL_MAX;
	rep(i,n)
	{
		double temp = rec(0, i);
		if (temp < ans)
		{
			ans = temp;
			first_v = i;
		}
	}

	vector<int> ans_list;
	ans_list.push_back(first_v);
	int s = 0 | 1 << first_v;
	int v = first_v;
	rep(i,n-1)
	{
		int next_v = next[s][v];
		ans_list.push_back(next_v);
		s = s | 1 << next_v;
		v = next_v;
	}

	rep(i,n)
	{
		cout << kura_num[ans_list[i]];
		if (i != n - 1) cout << " ";
	}
	cout << endl;
	
	//printf("%.5f\n", ans);
}