// AOJ 0146
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<limits>
#include<vector>
#define rep(i,a) for( int i = 0; i != (a); ++i )
#define repi(i,a,b) for( int i = (a); i != (b); ++i )

const int MAX_V = 15;
const double INF = std::numeric_limits<double>::max()/4.0;

int n;
int ord[MAX_V], d[MAX_V], w[MAX_V];
double dp[MAX_V][1<<MAX_V];
double ans = INF;
int ansOrd[MAX_V];

void rec( int v, double t, int ws, int S, std::vector<int> &ords )
{
	if( t > dp[v][S] )
		return;

	if( S == (1<<n)-1 && ans > t )
	{
		ans = t;

		rep( i, n )
			ansOrd[i] = ords[i];
		
		return;
	}

	rep( u, n )
	{
		if( !(S>>u&1) )
		{
			double vel = 2000.0/(70.0+ws), tim = t+abs(d[u]-d[v])/vel;
			ords.push_back( ord[u] );
			if( dp[u][S|1<<u] > tim )
			{
				dp[u][S|1<<u] = tim;
				rec( u, tim, ws+w[u]*20, S|1<<u, ords );
			}
			ords.pop_back();
		}
	}

	return;
}

int main()
{
	scanf( "%d", &n );
	rep( i, n )
		scanf( "%d%d%d", ord+i, d+i, w+i );

	std::fill( (double*)dp, (double*)(size_t(dp)+sizeof(dp)), INF );

	rep( i, n )
	{
		std::vector<int> vec( 1, ord[i] );
		rec( i, 0, w[i]*20, 1<<i, vec );
	}
	
	rep( i, n )
		printf( "%d%c", ansOrd[i], i==n-1?'\n':' ' );

	return 0;
}