#include <iostream>
#include <vector>
#include <bitset>

using namespace std;
double INF = 1000000000000.0;

int main() {
  int n;
  cin >> n;
  vector<int> dist(n);
  vector<int> gold(n);
  vector<int> nums(n);
  for (int i = 0; i < n; ++i) {
    cin >> nums[i] >> dist[i] >> gold[i];
  }
  vector<vector<double>> dp(n,vector<double>(1<<n,INF));
  vector<vector<int>> path(n,vector<int>(1<<n));
  for (int i = 0; i < n; ++i) {
    dp[i][1<<i] = 0.0;
  }
  for (int i = 1; i < (1 << n); ++i) {
    bitset<16> bs(i);
    int weight = 0;
    for (int j = 0; j < n; ++j) {
      if(bs[j]) {
        weight += gold[j] * 20;
      }
    }
    for (int j = 0; j < n; ++j) {
      if(!bs[j]) {
        int k = i | (1 << j);
        for (int l = 0; l < n; ++l) {
          if(bs[l]){
            double d = abs(dist[l] - dist[j]);
            double s = 2000.0 / (70.0 + weight);
            double t = d / s;
            if (dp[j][k] > dp[l][i] + t){
              dp[j][k] = dp[l][i] + t;
              path[j][k] = l;
            }
          }
        }
      }
    }
  }
  vector<int> steps(n);
  int bitmask = (1<<n)-1;
  int mini = 0;
  double mint = INF;
  for (int i = 0; i < n; ++i) {
    if (mint > dp[i][bitmask]) {
      mint = dp[i][bitmask];
      mini = i;
    }
  }
  for (int i = 0; i < n; ++i) {
    steps[n-i-1] = mini;
    int oldmini = mini;
    mini = path[mini][bitmask];
    bitmask ^= 1 << oldmini;
  }
  for (int i = 0; i < n; ++i) {
    if(i) cout << ' ';
    cout << nums[steps[i]];
  }
  cout << endl;
  return 0;
}