#include <iostream>
#include <cfloat>
#include <cmath>
using namespace std;

int n;
int c[15], d[15], w[15], r[15];
pair<double, int> dp[1<<15][15];
int wdp[1<<15];


int main() {
  int p, q;
  double t;
  cin >> n;
  for (int i=0; i<n; i++) {
    cin >> c[i] >> d[i] >> w[i];
    w[i] *= 20;
  }
  for (int i=0; i<(1<<n); i++) {
    wdp[i] = 0.0;
  }
  for (int i=0; i<(1<<n); i++) {
    for (int j=0; j<n; j++) {
      if (i & (1<<j)) {
        wdp[i] += w[j];
      }
    }
  }

  for (int i=0; i<(1<<n); i++) {
    for (int j=0; j<n; j++) {
      dp[i][j].first = DBL_MAX;
      dp[i][j].second = -1;
    }
  }
  for (int i=0; i<n; i++) {
    dp[1<<i][i].first = 0.0;
    dp[1<<i][i].second = -1;
  }
  for (int i=1; i<(1<<n); i++) {
    for (int j=0; j<n; j++) {
      if (~i & (1<<j)) continue;
      for (int k=0; k<n; k++) {
        if (i & (1<<k)) continue;
        t = dp[i][j].first + abs(d[k]-d[j])*(70 + wdp[i])/2000.0;
        if (dp[i|(1<<k)][k].first > t) { 
          dp[i|(1<<k)][k].first = t;
          dp[i|(1<<k)][k].second = j;
        }
      }
    }
  }
  p = -1;
  q = (1<<n)-1;
  t = DBL_MAX;
  for (int i=0; i<n; i++) {
    if (t > dp[q][i].first) {
      t = dp[q][i].first;
      p = i;
    }
  }
  for (int i=n-1; i>=0; i--) {
    r[i] = p;
    p = dp[q][p].second;
    q &= ~(1<<r[i]);
  }

  for (int i=0; i<n; i++) {
    if (i) cout << " ";
    cout << c[r[i]];
  }
  cout << endl;

  return 0;
}