#include<bits/stdc++.h>
#define INF (1e9)
#define s second
#define f first
#define N 15
using namespace std;
typedef pair<double,int> P;
typedef pair<P,int> P1;
int n,num[N],d[N],c[N],mintim,prev,prevs;
P1 dp[(1<<N)][N];
vector<int> ans;

double cal(double w,double dis){
  return dis/(2000/(70+20*w));
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>num[i]>>d[i]>>c[i];
  for(int i=0;i<(1<<n);i++)
    for(int j=0;j<n;j++)
      dp[i][j]=P1(P(INF,INF),INF);
  for(int i=0;i<n;i++)
    dp[(1<<i)][i]=P1(P(0,c[i]),-1);
  for(int i=0;i<(1<<n);i++){
    for(int j=0;j<n;j++){
      if(!(i&(1<<j)))continue;
      if(dp[i][j].second==INF)continue;
      for(int k=0;k<n;k++){
	if((i&(1<<k)))continue;
	double tim=dp[i][j].f.f;
	int dis=abs(d[j]-d[k]);
	int w=dp[i][j].f.s;
	double r=tim+cal(w+c[j],dis);
	dp[(i|(1<<k))][k]=min(dp[(i|(1<<k))][k],P1(P(r,w+c[j]),j));
      }
    }
  }
  int last=0;
  mintim=dp[(1<<n)-1][0].f.f;
  prev=dp[(1<<n)-1][0].s;
  prevs=((1<<n)-1)-(1<<0);
  for(int i=1;i<n;i++)
    if(mintim>dp[(1<<n)-1][i].f.f){
      mintim=dp[(1<<n)-1][i].f.f;
      prev=dp[(1<<n)-1][i].s;
      prevs=((1<<n)-1)-(1<<i);
      last=i;
    }
  ans.push_back(last);
  while(1){
    int ima=prev;
    ans.push_back(prev);
    prev=dp[prevs][prev].s;
    if(prev==-1)break;
    prevs=prevs-(1<<ima);
  }
  reverse(ans.begin(),ans.end());
  for(int i=0;i<ans.size();i++){
    if(i)cout<<' ';
    cout<<num[ans[i]];
  }
  cout<<endl;
  return 0;
}