#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

typedef vector<double> VD;
typedef vector< VD > VVD;

int weight( int flag, VI boxes )
{
	const int N = boxes.size();

	int res = 0;

	REP( i, 0, N )
	{
		if ( !( ( flag >> i ) & 1 ) )
		{
			continue;
		}

		res += boxes[i];
	}

	return res * 20;
}

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	int n;
	cin >> n;

	VI num( n ), dists( n ), boxes( n );

	REP( i, 0, n )
	{
		cin >> num[i] >> dists[i] >> boxes[i];
	}

	VVD dp( 1 << n, VD( n, DBL_MAX ) );

	REP( i, 0, n )
	{
		dp[ 1 << i ][i] = 0;
	}

	VVI prev( 1 << n, VI( n ) );

	REP( flag, 1, 1 << n )
	{
		REP( i, 0, n )
		{
			if ( dp[ flag ][i] == DBL_MAX )
			{
				continue;
			}

			REP( j, 0, n )
			{
				if ( ( flag >> j ) & 1 )
				{
					continue;
				}

				int nflag = flag | ( 1 << j );
				double time = abs( dists[i] - dists[j] ) / ( 2000. / ( 70 + weight( flag, boxes ) ) );

				if ( dp[ nflag ][j] <= dp[ flag ][i] + time )
				{
					continue;
				}

				dp[ nflag ][j] = dp[ flag ][i] + time;
				prev[ nflag ][j] = i;
			}
		}
	}

	int flag = ( 1 << n ) - 1, cur = -1;
	
	REP( i, 0, n )
	{
		if ( cur == -1 || dp[ flag ][i] < dp[ flag ][ cur ] )
		{
			cur = i;
		}
	}
	
	VI seq;

	while ( 0 < flag )
	{
		seq.PB( cur );

		int nflag = flag ^ ( 1 << cur );
		int next = prev[ flag ][ cur ];

		flag = nflag;
		cur = next;
	}
	
	reverse( ALL( seq ) );

	REP( i, 0, n )
	{
		if ( i )
		{
			cout << ' ';
		}

		cout << num[ seq[i] ];
	}
	cout << endl;

	return 0;
}