//29
#include<iostream>
#include<queue>
#include<vector>
#include<cstdlib>
#include<algorithm>

using namespace std;

double t[1<<15][15];
int p[1<<15][15];
int n;
int k[15],d[15],s[15];

void dfs(int f,int ds){
  if(t[f][ds]!=1<<30)return;
  for(int i=0;i<n;i++){
    if(f&1<<i){
      int nf=f&~(1<<i);
      dfs(nf,i);
      double nt=t[nf][i];
      int w=0;
      for(int j=0;j<n;j++){
	if(nf&1<<j){
	  w+=s[j]*20;
	}
      }
      nt+=abs(d[ds]-d[i])/(2000./(70+w));
      if(nt<t[f][ds]){
	t[f][ds]=nt;
	p[f][ds]=i;
      }
    }
  }
}
	
    

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>k[i]>>d[i]>>s[i];
  }
  fill(t[0],t[1<<15],1<<30);
  fill(p[0],p[1<<15],-1);
  for(int i=0;i<n;i++){
    t[0][i]=0;
  }
  int mn=1<<30;
  int x;
  for(int i=0;i<n;i++){
    dfs((1<<n)-1,i);
    if(mn>t[(1<<n)-1][i]){
      mn=t[(1<<n)-1][i];
      x=i;
    }
  }
  vector<int> v;
  int f=(1<<n)-1;
  while(x!=-1){
    v.push_back(x);
    int nf=f&~(1<<x);
    x=p[f][x];
    f=nf;
  }
  for(int i=0;i<n;i++){
    cout<<k[v[n-1-i]]<<((i!=n-1)?' ':'\n');
  }
  return 0;
}


/*
struct S{
  int w,f,i;
  double t;
  vector<int> v;
  bool operator<(S a)const{
    return t>a.t;
  }
};

int main(){
  int n;
  cin>>n;
  int k[15],d[15],s[15];
  for(int i=0;i<n;i++){
    cin>>k[i]>>d[i]>>s[i];
  }
  priority_queue<S> que;
  for(int i=0;i<n;i++){
    S is;
    is.t=0;
    is.f=1<<i;
    is.i=i;
    is.w=s[i];
    is.v.push_back(k[i]);
    que.push(is);
  }
  bool p[1<<15][15]={{}};
  for(;;){
    S c=que.top();
    if(c.f==(1<<n)-1)break;
    que.pop();
    if(p[c.f][c.i]++)continue;
    for(int i=0;i<n;i++){
      S n=c;
      n.t+=abs(d[c.i]-d[i])/(2000./(70+c.w*20));
      n.f|=1<<i;
      n.i=i;
      n.w+=s[i];
      n.v.push_back(k[i]);
      if(!p[n.f][n.i]){
	que.push(n);
      }
    }
  }
  for(int i=0;i<n;i++){
    cout<<que.top().v[i]<<((i==n-1)?'\n':' ');
  }
  return 0;
}
*/