#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
const int64 INF = 1LL << 60;
inline int64 ABS(int64 A, int64 B){ return(max(A - B, B - A)); }

int n;
int idx[15], dist[15], cost[15];

int64 weight[1 << 15];
int64 dp[15][1 << 15];
pair< int, int > previdx[15][1 << 15];

int main()
{
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> idx[i] >> dist[i] >> cost[i];
  }
  for(int i = 1; i < 1 << n; i++) {
    for(int j = 0; j < n; j++) {
      if((i >> j) & 1) weight[i] += cost[j];
    }
    weight[i] *= 20;
  }
  fill_n( *previdx, 15 * (1 << 15), make_pair(-1, -1));
  fill_n( *dp, 15 * (1 << 15), INF);
  for(int i = 0; i < n; i++) {
    dp[i][1 << i] = 0;
  }
  for(int i = 1; i < 1 << n; i++) {
    for(int j = 0; j < n; j++) {
      if(!((i >> j) & 1)) continue;
      if(dp[j][i] == INF) continue;
      for(int k = 0; k < n; k++) {
        if((i >> k) & 1) continue;
        int64 Cost = dp[j][i] + ABS(dist[j], dist[k]) * (70LL + weight[i]);
        if(dp[k][i|(1 << k)] >= Cost) {
          dp[k][i|(1 << k)] = Cost;
          previdx[k][i|(1 << k)] = make_pair(j, i);
        }
      }
    }
  }

  pair< int64, int > ret = make_pair(INF, -1);
  int mask = (1 << n) - 1;
  for(int i = 0; i < n; i++) {
    ret = min(ret, make_pair(dp[i][(1 << n) - 1], i));
  }
  stack< int > Que;
  while(ret.second >= 0) {
    Que.push(idx[ret.second]);
    pair< int, int > p =  previdx[ret.second][mask];
    ret.second = p.first;
    mask = p.second;
  }
  bool first = false;
  while(!Que.empty()) {
    if(first++) cout << " ";
    cout << Que.top();
    Que.pop();
  }
  cout << endl;

}