#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int n;
int id[15];
int dist[15];
int w[15];
double dp[15][1<<15][15];
vector<int> path[15][1<<15];

const double INF = 100000000.0;

main(){
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> id[i] >> dist[i] >> w[i];
  }
  fill(dp[0][0], dp[15][0], INF);
  for(int i=0;i<n;i++){
    dp[0][1<<i][i] = 0.0;
    path[i][1<<i].push_back(i);
  }
  for(int i=0;i<15;i++){
    for(int j=0;j<(1<<n);j++){
      for(int k=0;k<n;k++){
	if(dp[i][j][k] == INF) continue;
	int sumW = 0;
	for(int l=0;l<n;l++){
	  if((1<<l) & j) sumW += w[l];
	}
	sumW *= 2;
	for(int l=0;l<n;l++){
	  if((1<<l) & j) continue;
	  double val = dp[i][j][k] + (abs(dist[l] - dist[k]) * (7.0 + sumW)) / 200.0;
	  if(val < dp[i+1][j|(1<<l)][l]){
	    dp[i+1][j|(1<<l)][l] = val;
	    path[l][j|(1<<l)] = path[k][j];
	    path[l][j|(1<<l)].push_back(l);
	  }
	}
      }
    }
  }
  double valm = INF;
  int idx;
  int state = (1<<n)-1;
  int maxW = 0;
  vector<int> ans;
  for(int i=0;i<n;i++){
    maxW += w[i];
  }
  for(int i=0;i<n;i++){
    double val = dp[n-1][state][i];
    /*cout << id[path[i][state][0]];
    for(int j=1;j<path[i][state].size();j++){
      cout << ' ' << id[path[i][state][j]];
    }
    cout << "   ";
    cout << val << endl;*/
    if(val < valm){
      valm = val;
      idx = i;
    }
  }
  cout << id[path[idx][state][0]];
  for(int i=1;i<path[idx][state].size();i++){
    cout << ' ' << id[path[idx][state][i]];
  }
  cout << endl;
  return 0;
}