#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);i++)
#define INF 1e+100
#define vint vector<int>

using namespace std;
	
int main()
{
	int n;
	cin >> n;

	int MAX = (1 << n), ID[n], d[n], box[n];
	rep (i, n )
		cin >> ID[i] >> d[i] >> box[i];

	double dp[n][MAX];
	vint path[n][MAX];

	int w[MAX];

	rep (i, MAX ){
		int sum = 0, cnt = 0;
		for (int j = 1; j < MAX; j = (j << 1), cnt++ ){
			if ((i & j ) != 0 ){
				sum += box[cnt];
			}// end if
		} // end for
		w[i] = sum*20;
	} // end rep

	fill (&dp[0][0], &dp[n-1][MAX], INF );

	rep (i, n ){
		dp[i][1 << i] = 0.;
		path[i][1 << i].push_back (i );
	} // end rep

	rep (i, MAX ){
		double v = 2000.0/(double)(70 + w[i] );
		rep (j, n ){
			int now = (1 << j );
			if ( (i & now ) == 0 ) continue;	// Ü¾KêÄ¢È¢
			rep (k, n ){
				int next = (1 << k );
				if ( (i & next ) ) continue;	// à¤Kê½
				double cost = (double)(abs(d[j] - d[k] ) )/v;
				if (dp[k][i|next] > dp[j][i] + cost ){
					dp[k][i|next] = dp[j][i] + cost;
					path[k][i|next] = path[j][i];
					path[k][i|next].push_back (k );
				} // end if
			} // end rep
		} // end rep
	} // end rep
	
	double min = INF;
	vint ans;

	rep (i, n ){
		if (min > dp[i][MAX-1] ){
			min = dp[i][MAX-1];
			ans = path[i][MAX-1];
		} // end if
	} // end rep

	rep (i, ans.size() ){
		if (i != 0 )
			cout << ' ';
		cout << ID[ans[i]];
	} // end rep
	cout << endl;			 
		
	return 0;
}