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

using namespace std;

#define MAX 15
#define INF 1e9

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

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

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

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

  double res = INF;
  for(int i = 0 ; i < N ; i++){
    if(S >> i & 1) continue;
    double next = solve(S|(1<<i),i,b+B[i]) + dist(prev,i)/V(b);
    if(next < res){
      res = next;
    }
  }
  
  return dp[S][prev] = res;
}

void path(int S,int prev){
  ans.push_back(n[prev]);
  if(S == (1<<N)-1) return;
  int idx = -1;
  double res = INF;
  for(int i = N-1 ; i >= 0 ; i--){
    if(S >> i & 1) continue;
    int next = S | (1<<i);
    if(dp[next][i] < res && dp[next][i] >= 0){
      res = dp[next][i];
      idx = i;
    }
  }
  path(S|(1<<idx),idx);
}

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] = -1;
    }
  }
  int idx = -1;
  for(int i = 0 ; i < N ; i++){
    double now = solve(1<<i,i,B[i]);
    if(now < mt){
      mt = now;
      idx = i;
    }
  }
  path(1<<idx,idx);
  for(int i = 0 ; i < N ; i++){
    if(i == N-1){
      cout << ans[i] << endl;
    }else{
      cout << ans[i] << " ";
    }
  }

  return 0;
}