#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;i--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);i--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};

int a[20],b[20],c[20],n;
pair<double,int> dp[1<<16][20];

double f(int bit,int now){
	if(bit==0)return 0;
	if(dp[bit][now].first>=0)return dp[bit][now].first;
	int weight=0;
	rep(i,n){
		if((bit&1<<i)>0)continue;
		weight+=c[i];
	}
	double res=-1;
	rep(i,n){
		if((bit&1<<i)==0)continue;
		double k=f(bit^1<<i,i)+abs(b[i]-b[now])/(2000./(70+weight*20));
		if(res<0||res>k){
			dp[bit][now].first=k;
			dp[bit][now].second=i;
			res=k;
		}
	}
	return res;
}

int main() {
	n=in();
	rep(i,n){
		cin>>a[i]>>b[i]>>c[i];
	}
	rep(i,1<<16)rep(j,20){
		dp[i][j].first=-1;
		dp[i][j].second=-1;
	}
	double res=-1;
	rep(i,n){
		double k=f(((1<<n)-1)^1<<i,i);
		if(res<0||res>k){
			res=k;
			dp[(1<<n)-1][0].second=i;
		}
	}
	int bit=(1<<n)-1,now=dp[(1<<n)-1][0].second;
	while(bit){
		if(bit<(1<<n)-1)cout<<" ";
		cout<<a[now];
		bit^=1<<now;
		now=dp[bit][now].second;
	}
	cout<<endl;
	return 0;
}