#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
#include<sstream>
using namespace std;
typedef long long ll;

const double INF = 1e9;

int N;
double dp[1 << 15][15];
int prev_[1 << 15][15];

int main(){
	int num[15], d[15], size[15];
	cin >> N;
	for(int i = 0; i < N; i++)
	{
		cin >> num[i] >> d[i] >> size[i];
	}

	fill_n((double*)dp, (1 << 15) * 15, INF);
	//fill_n((int*)prev_, (1 << 15) * 15, -1);
	for(int i = 0; i < N; i++) dp[0][i] = 0;

	for(int i = 0; i < (1 << N); i++)
	{
		int w = 0;
		for(int j = 0; j < N; j++)
		{
			w += size[j] * 20 * ((i >> j) & 1);
		}
		for(int j = 0; j < N; j++)
		{
			if(dp[i][j] > INF - 1) continue;
			for(int k = 0; k < N; k++)
			{
				if(j == k) continue;
				int nextS = i | (1 << k);
				double nextT = dp[i][j] + abs(d[j] - d[k]) * (70.0 + w) / 2000.0;
				if(dp[nextS][k] > nextT)
				{
					dp[nextS][k] = nextT;
					prev_[nextS][k] = j;
				}
			}
		}
	}

	vector<int> ans;
	int pos, s = (1 << N) - 1;
	double mi = INF;
	for(int i = 0; i < N; i++)
	{
		if(mi > dp[s][i])
		{
			pos = i;
			mi = dp[s][i];
		}
	}

	ans.push_back(pos);
	while(true)
	{
		int nextS = s ^ (1 << pos);
		pos = prev_[s][pos];
		s = nextS;
		if(s == 0) break;
		ans.push_back(pos);
	}

	for(int i = ans.size() - 1; i > 0; i--)
	{
		printf("%d ", num[ans[i]]);
	}
	printf("%d\n", num[ans[0]]);
	return 0;
}