#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define REV(s) (s).rbegin(), (s).rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const double EPS = 1e-9;
double dp[1<<15][15];
int id[15], d[15], num[15];

int w[1<<15];
int nxt[1<<15];

int n;
double dfs(int vis, int pos){
	if(vis+1 == 1<<n) return 0;

	double &res = dp[vis][pos];
	if(res > -EPS) return res;

	res = 1e15;
	rep(i, n){
		if(vis&(1<<i)) continue;
		double t = dfs(vis|(1<<i), i)+abs(d[pos]-d[i])/(2000./(70+w[vis]));
		if(res > t){
			res = t;
			nxt[vis] = vis|(1<<i);
		}
	}

	return res;
}

int main(){
	cin >> n;
	rep(i, n) cin >> id[i] >> d[i] >> num[i];
	rep(i, 1<<n) rep(j, n) if(i&(1<<j)) w[i] += num[j]*20;

	rep(i, 1<<n) rep(j, n) dp[i][j] = -1;
	dfs(0, 0);

	vector<int> ans;
	int x = 0;
	while(x+1 != 1<<n){
		int xx = x^nxt[x];
		rep(i, n) if(xx&(1<<i)) ans.push_back(id[i]);
		x = nxt[x];
	}

	rep(i, ans.size()){
		cout << (i?" ":"") << ans[i];
	}
	cout << endl;

	return 0;
}