#include<bits/stdc++.h>
using namespace std;
long long n,s[15],d[15],v[15];vector<long long>Z;
pair<long long,vector<long long>>dp[1<<15][15];
int main(){
	cin>>n;for(int i=0;i<n;i++)cin>>s[i]>>d[i]>>v[i];
	for(int i=0;i<(1<<n);i++){for(int j=0;j<n;j++)dp[i][j]=make_pair(2e18,Z);}
	for(int i=0;i<n;i++){dp[(1<<i)][i]=make_pair(0,vector<long long>{s[i]});}
	
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<n;j++){
			if(dp[i][j].first>19e17)continue;
			long long u=0;for(int k=0;k<n;k++){if((i/(1<<k))%2==1)u+=v[k];}
			u*=20;u+=70;
			for(int k=0;k<n;k++){
				if((i/(1<<k))%2==1)continue;
				int sc=dp[i][j].first+abs(d[k]-d[j])*u;
				if(dp[i+(1<<k)][k].first>sc){
					dp[i+(1<<k)][k].first=sc;vector<long long>c=dp[i][j].second;
					c.push_back(s[k]);dp[i+(1<<k)][k].second=c;
				}
			}
		}
	}
	long long minx=2e18;vector<long long>ret;
	for(int i=0;i<n;i++){
		if(minx>dp[(1<<n)-1][i].first){
			minx=dp[(1<<n)-1][i].first;ret=dp[(1<<n)-1][i].second;
		}
	}
	for(int i=0;i<(int)ret.size();i++){if(i)cout<<' ';cout<<ret[i];}cout<<endl;
	return 0;
}