#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int b[15],c[15],e[15],f[15],g[15],n;
double a[15][32768],d=0.0;
void fn(int o,int p,int q,int r,double s){
  int i;
  if(o==n){
    if(d==0||d>s){
      d=s;
      memcpy(c,b,n*sizeof(int));
    }
  }else if(a[p][q]==0||a[p][q]>s){
    a[p][q]=s;
    for(i=0;i<n;i++){
      if((q&(1<<i))==0){
	b[o]=e[i];
	fn(o+1,i,q|(1<<i),r+g[i],s+abs(f[p]-f[i])*(70+20*r)/2000.0);
      }
    }
  }
  return;
}
int main(){
  int i;
  cin>>n;
  for(i=0;i<n;i++)
    cin>>e[i]>>f[i]>>g[i];
  memset(a,0.0,sizeof(a));
  for(i=0;i<n;i++){
    b[0]=e[i];
    fn(1,i,1<<i,g[i],f[i]*70/2000.0);
  }
  for(i=0;i<n-1;i++)
    cout<<c[i]<<" ";
  cout<<c[i]<<endl;
  return 0;
}