#include<iostream>
#include<cstdlib>
using namespace std;

int main(){
  double dp[1<<15][15];
  int prv[1<<15][15];
  int n;
  int num[15],pos[15],w[15],ans[15];

  cin >> n;
  for(int i=0;i<n;i++)cin >> num[i] >> pos[i] >> w[i];

  for(int i=0;i<(1<<n);i++){
    for(int j=0;j<n;j++){
      dp[i][j] = 1e+10;
      prv[i][j] = -1;
    }
  }
  for(int i=0;i<n;i++){
    dp[(1<<i)][i] = (double)pos[i]*70/20000;
    prv[(1<<i)][i] = i;
  }

  for(int i=0;i<(1<<n);i++){
    int weight = 0;
    for(int j=0;j<n;j++){
      if( i &(1<<j) )weight += w[j];
    }
    for(int j=0;j<n;j++){
      if( i &(1<<j) ){
	int tmp = i-(1<<j);
	for(int k=0;k<n;k++){
	  if(tmp &(1<<k)){
	    double dis = abs(pos[k] - pos[j]);
	    double d = dp[tmp][k]+dis*(70+20*(weight-w[j]))/20000;
	    if(dp[i][j]>d){
	      dp[i][j] = d;
	      prv[i][j] = k;
	    }
	  }
	}
      }
    }
  }

  int a = 0;
  for(int i=1;i<n;i++){
    if(dp[(1<<n)-1][i] < dp[(1<<n)-1][a])a = i;
  }
 
  int c = n-1;
  int p = (1<<n) - 1;  
  while(p){
    ans[c] = a;
    a = prv[p][a];
    p -= (1<<ans[c]);
    c--;
  }

  for(int i=0;i<n-1;i++)cout << num[ans[i]] << " ";
  cout << num[ans[n-1]] << endl;
}