#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define DBG(X) cout<<" "<<#X<<" : "<<X<<endl
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;

const int INF = 1e9;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;
const double PI = acos(-1);

struct Input
{
	int n;char c;char str[1024];string s;ll l;
	int nextInt(){scanf("%d", &n);return n;}
	ll nextLong(){scanf("%lld", &l);return l;}
	char nextChar(){scanf("%c", &c);return c;}
	string next(){scanf("%s", str);return string(str);}
	string nextLine(){getline(cin, s);return s;}
};
Input in;

pair<double, int> dp[(1<<15) + 10][25];

int num[25], dist[25], v[25];

int w[(1<<15) + 10];

int main(){
	int n = in.nextInt();
	rep(i, n){
		num[i] = in.nextInt(), dist[i] = in.nextInt(), v[i] = in.nextInt();
	}
	rep(i, 1<<n) {
		int sum = 0;
		rep(j, n){
			dp[i][j] = mp(1e18, -1);
			if((i & (1<<j)) != 0) sum += v[j];
		}
		w[i] = sum * 20;
	}

	rep(i, n) dp[1<<i][i].fi = 0.0;
	rep(i, 1<< n){
		rep(now, n){
			if((i & (1<<now)) == 0) continue;
			rep(nxt, n){
				if((i & (1<<nxt)) != 0) continue;
				dp[i | (1<<nxt)][nxt] = min(dp[i | (1<<nxt)][nxt], 
					mp(dp[i][now].fi + (abs(dist[now] - dist[nxt]) * (70.0+w[i])/ 2000.0), now));
			}
		}
	}
	vi ans;
	int idx = 0, last = (1<<n) -1;
	for(int i = 1; i < n; i++){
		if(dp[last][i] < dp[last][idx]) idx = i;
	}
	int prv = last;

	// for(int i = 0; i < 1<<n; i++){
	// 	for(int j = 0; j < n; j++){
	// 		printf(" (%3d, %3d) : ", i, j);
	// 		cout<<dp[i][j].fi<<endl;
	// 	}
	// }

	while(idx != -1){
		ans.pb(num[idx]);
		int tmp = dp[prv][idx].se;
		prv -= (1<<idx);
		
		idx = tmp;
	}
	reverse(all(ans));
	
	rep(i, n) {
		if(i != 0) cout<<" ";
		cout<<ans[i];
	}
	cout<<endl;
}