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

using namespace std;

#define MAX 15
#define INF 1e9
typedef pair<double,vector<int> > P;

int N;
P dp[1<<MAX][MAX];
double mt,d[MAX],B[MAX];
vector<int> path;
int n[MAX];

double V(double w){
  return 2000. / (70. + w);
}

double dist(int a,int b){
  return abs(d[a]-d[b]);
}

P solve(int S,int prev,double b,vector<int> &v){
  if(S == (1<<N)-1) return P(0.0,v);
  if(dp[S][prev].first >= 0) return dp[S][prev];

  P res = P(INF,vector<int>()); 
  for(int i = 0 ; i < N ; i++){
    if(S >> i & 1) continue;
    double now;
    double nt = dist(prev,i) / V(b);
    v.push_back(n[i]);   
    P next = solve(S|(1<<i),i,b+B[i],v);
    now = next.first + nt;
    if(now < res.first){
      res = P(now,next.second);
    } 
    v.pop_back();
  }
  
  return dp[S][prev] = res;
}

int main(){
  cin >> N;
  for(int i = 0 ; i < N ; i++){
    cin >> n[i] >> d[i] >> B[i];
    B[i] *= 20;
  }
  mt = INF;
  for(int i = 0 ; i < 1<<N ; i++){
    for(int j = 0 ; j < N ; j++){
      dp[i][j] = P(-1,vector<int>());
    }
  } 
  for(int i = 0 ; i < N ; i++){
    vector<int> p;
    p.push_back(n[i]);
    P now = solve(1<<i,i,B[i],p);
    if(now.first < mt){
      mt = now.first;
      path = now.second;
    }
  }
  int size = path.size();
  for(int i = 0 ; i < size ; i++){
    if(i == 0){
      cout << path[i];  
    }else{
      cout << " " << path[i];
    }
  }
  cout << endl;

  return 0;
}