#include<iostream>
#include<bitset>
#include<vector>
#include<cstdlib>

#define INV (-1)
#define INFTY 2000000000
#define UNIT 20
#define MAX 15
#define ST_MAX 32756

using namespace std;

int ids[MAX];
int weights[MAX];
double distances[MAX][MAX];
double A[ST_MAX][MAX];
int a[ST_MAX][MAX];

inline double V(int n)
{
	return double(2000) / (70 + n*UNIT);
}
double W(int from, int to, unsigned long bits)
{
	int nb = 0;
	int w = 0;
	while(bits > 0)
	{
		w += ( (bits & 1) ? weights[nb] : 0);
		bits = bits >> 1;
		++nb;
	}
	return distances[from][to] / V( w );
}
void comb_compute(int n, int k)
{
	int *p;
	bool loop = false;
	p = new int[k];for(int i = 0; i < k; i++) p[i] = i;	
	do{

		bitset<MAX> b;
		loop = false;
		
		for(int i = 0; i < k; ++i)
			b.set(p[i]);
		
		for(int i = 0; i < n; ++i)
		{
			if( !b[i] )
			{
				int min_ind = INV;
				double min_t = INFTY;
				for(int j = 0; j < k; ++j)
				{
					double t;
					bitset<MAX> tb = b;
					tb.reset( p[j] );
					t = A[tb.to_ulong()][ p[j] ] + W( p[j], i, b.to_ulong() );
					if( t < min_t )
					{
						min_t = t;
						min_ind = p[j];
					}
				}
				A[b.to_ulong()][i] = min_t;
				a[b.to_ulong()][i] = min_ind;
			}
		}

	for(int pk=k-1;pk>=0;pk--){p[pk]++;if(p[pk]<=n-(k-pk)){for(int j=pk+1;j<k;j++)p[j]=p[j-1]+1;pk++;loop=true;break;}}
	}while(loop);delete [] p;
}
void input(int n){
	int dist[MAX];

	for(int i = 0; i < n; ++i)
		cin >> ids[i] >> dist[i] >> weights[i];
	
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < n; ++j)
			distances[i][j] = abs( dist[i] - dist[j] );
}
void compute(int n)
{
	unsigned long l = 1;

	for(int i = 0; i < ST_MAX; ++i)
		for(int j = 0; j < MAX; ++j)
		{
			A[i][j] = INFTY;
			a[i][j] = INV;
		}
	
	for(int i = 0; i < MAX; ++i)
		A[0][i] = 0;

	for(int k = 1; k <= n; ++k)
		comb_compute(n, k);
}
void result(int n)
{
	int min_ind = INV;
	double min_t = INFTY;
	unsigned long min_st = (1<<n)-1;
	vector<int> vAns;
	bitset<MAX> bMax( (1<<n) - 1 );

	/*for(int i = 0; i < (1<<n); ++i){
		bitset<MAX> b(i);
		for(int j = 0; j < n; ++j){
			cout << b.to_string() << ':' << A[b.to_ulong()][j] << endl;
		}
		cout << "---\n";
	}*/

	for(int i = 0; i < n; ++i)
	{
		bMax.reset( i );
		if( A[bMax.to_ulong()][i] < min_t )
		{
			min_t = A[bMax.to_ulong()][i];
			min_ind = i;
			min_st = bMax.to_ulong();
		}
		bMax.set( i );
	}

	while( true )
	{
		vAns.push_back( min_ind );
		bMax.reset( min_ind );
		min_ind = a[bMax.to_ulong()][ min_ind ];
		if( min_ind == INV )
			break;
	}

	for(int i = vAns.size() - 1; i >= 0; --i){
		if( i == vAns.size() - 1 )
			cout << ids[vAns[i]];
		else
			cout << ' ' << ids[vAns[i]];
	}
	cout << '\n';
}
int main()
{
	int n;
	cin >> n;

	input( n );
	compute( n );
	result( n );

	return 0;
}