#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
 
using namespace std;
 
#define MAX 15
#define INF 1e9
 
struct Pair{
  int n;
  double d,b;
  Pair() {}
  Pair(int n,double d,double b) : n(n), d(d), b(b) {}
};
 
int N;
double dp[1<<MAX][MAX],mt;
vector<int> path,p;
vector<Pair> vec;
 
double V(double w){
  return 2000. / (70. + w);
}
 
double dist(int a,int b){
  return abs(vec[a].d-vec[b].d);
}
 
double solve(int S,int prev,double t,double b){
  if(S == (1<<N)-1){
    if(t < mt){
      mt = t;
      path = p;
    }
    return t;
  }
  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 nt = dist(prev,i) / V(b);
    p.push_back(vec[i].n);
    res = min(res,solve(S|(1<<i), i, t+nt, b+vec[i].b));    
    p.pop_back();
  }
  return dp[S][prev] = res;
}
 
int main(){
  cin >> N;
  vec.resize(N);
  for(int i = 0 ; i < N ; i++){
    cin >> vec[i].n >> vec[i].d >> vec[i].b;
    vec[i].b *= 20;
  }
  memset(dp,-1,sizeof(dp)); mt = INF;
  for(int i = 0 ; i < N ; i++){
    p.push_back(vec[i].n);
    solve(1<<i,i,0,vec[i].b);
    p.pop_back();
  }
  int size = path.size();
  for(int i = 0 ; i < size ; i++){
    if(i == size-1){
      cout << path[i] << endl;
    }else{
      cout << path[i] << " ";
    }
  }
 
  return 0;
}