#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip	;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	cin>>n;
	vi m(n);
	vp in(n);
	rep(i,n)cin>>m[i]>>in[i].first>>in[i].second;
	int N=1<<n;
	vector<vector<pair<double,int> > >dp(N,vector<pair<double,int> >(n,pair<double,int>(inf,inf)));
	rep(i,n)dp[1<<i][i]=pair<double,int>(in[i].first*70./2000.,-1);
	loop(i,1,N)rep(j,n)if(i&1<<j){
		int sum=0;
		rep(k,n)if(i&1<<k)sum+=in[k].second;
//		cout<<i<<" "<<j<<" "<<sum<<endl;
		rep(k,n)if(!(i&1<<k)&&dp[i|1<<k][k].first>dp[i][j].first+abs(in[j].first-in[k].first)*(ll)(70+sum*20)/2000.){
			dp[i|1<<k][k]=pair<double,int>(dp[i][j].first+abs(in[j].first-in[k].first)*(ll)(70+sum*20)/2000.,j);
		}
	}
	double mi=inf;
	rep(i,n)mi=min(mi,dp[N-1][i].first);
	rep(i,n)if(mi==dp[N-1][i].first){
		vi out;
		out.pb(i);
		int t=i,T=N-1;
		while(dp[T][t].second!=-1){
			out.pb(dp[T][t].second);
			int tmp=t;
			t=dp[T][t].second;
			T-=1<<tmp;
		}
		for(int j=out.size()-1;j>=0;j--)
			cout<<m[out[j]]<<(j?" ":"\n");
		break;
	}
}