#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef vector<double> vd;
typedef vector<vd> vvd;

struct Store
{
	int id;
	int dist;
	int money;
};

int main()
{
	int n;
	scanf("%d", &n);
	
	vector<Store> stores(n);
	rep(i, n){
		scanf("%d%d%d", &stores[i].id, &stores[i].dist, &stores[i].money);
	}
	
	vvd t(1<<n, vd(n, 1e20));
	vvi w(1<<n, vi(n));
	vvi p(1<<n, vi(n));
	rep(i, n){
		t[1<<i][i] = 0.0;
		w[1<<i][i] = stores[i].money * 20;
		p[1<<i][i] = -1;
	}
	
	rep(i, 1<<n){
		rep(j, n){
			rep(k, n){
				if(j==k || (i&(1<<j)) == 0 || (i&(1<<k)) == 0)
					continue;
				int pre = i ^ (1<<k);
				double tmp = t[pre][j] + abs(stores[j].dist - stores[k].dist) * (70.0 + w[pre][j]) / 2000.0;
				if(tmp < t[i][k]){
					t[i][k] = tmp;
					w[i][k] = w[pre][j] + stores[k].money * 20;
					p[i][k] = j;
				}
			}
		}
	}
	
	vector<int> path;
	int minid = distance(t[(1<<n)-1].begin(), min_element(t[(1<<n)-1].begin(), t[(1<<n)-1].end()));
	path.push_back(minid);
	for(int i=(1<<n)-1; p[i][minid]!=-1;){
		int tmp = minid;
		minid = p[i][minid];
		i ^= 1 << tmp;
		path.push_back(minid);
	}
	
	for(int i=path.size()-1; i>=0; --i)
		printf("%d%s", stores[path[i]].id, i?" ":"");
	puts("");

	return 0;
}