#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

typedef double Weight;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;


int main() {
  int n;
  cin >> n;
  
  int a[n], l[n], m[n];
  REP(i,n)
    cin >> a[i] >> l[i] >> m[i];
  Matrix mat(n, Array(n));
  REP(i,n)
    REP(j,n)
    mat[i][j] = abs(l[j]-l[i]);

  int N = 1<<n;
  Weight best[N][n];
  int prev[N][n];

  REP(i,N)
    REP(j,n)
    best[i][j] = INF;
  REP(i,n) best[1<<i][i] = 0;
  REP(S,N) {
    int we = 0;
    REP(i,n) // ツ個サツ催敖づ個重ツつウツづーツ計ツ算
      if (S&(1<<i))
        we += m[i];
    we = 70 + 20 * we;
    REP(i,n)
      if (S&(1<<i))
        REP(j,n) {
          if (best[S|(1<<j)][j] > best[S][i] + mat[i][j] * (we + 70)) {
            best[S|(1<<j)][j] = best[S][i] + mat[i][j] * (we + 70);
            prev[S|(1<<j)][j] = i;
          }
        }
  }

  vector<int> path;
  int t = min_element(best[N-1], best[N-1] + n) - best[N-1]; // ツ可スツ氾板姪堋づ個陳クツ点ツづ終ツづュツづゥツづ個つェツ暗ェツ氾板短ツつュツづ按づゥツつゥ

  int S = N-1;
  while(S) {
    path.push_back(t);
    int tmp = prev[S][t];
    S ^= (1<<t);
    t = tmp;
  }
  reverse(ALL(path));

  REP(i, path.size()) {
    if (i)
      cout << " ";
    cout << a[path[i]];
  }
  cout << endl;
}