#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<double, int> P;
const int INF = 1e9;
const int W = 20;

int N;

double get_time(int b, int bef, int now, vector<int> &num, vector<int> &dist, vector<int> &cnt){
  int w = 0;
  REP(i, N) if(1 & (b >> i)) w += cnt[i];
  w *= 20;
  int d = abs(dist[bef] - dist[now]);
  return d / (2000.0 / (70 + w));
}

int main() {
  cin >>N;
  vector<int> num(N), dist(N), cnt(N);
  REP(i, N) cin >>num[i] >>dist[i] >>cnt[i];
  vector< vector<P> > dp((1 << N), vector<P>(N, P(INF, INF)));
  REP(i, N) dp[(1 << i)][i] = P(0.0, -1);
  REP(b, (1 << N)){
    REP(bef, N){
      if(dp[b][bef].first == INF) continue;
      REP(now, N){
        if(1 & (b >> now)) continue;
        double t = get_time(b, bef, now, num, dist, cnt);
        int nb = b | (1 << now);
        dp[nb][now] = min(dp[nb][now], P(dp[b][bef].first + t, bef));
      }
    }
  }
  int tar = 0, bit = (1 << N) - 1;
  FOR(i, 1, N) if(dp[bit][i].first < dp[bit][tar].first) tar = i;
  vector<int> ans;
  ans.push_back(tar);
  while(dp[bit][tar].second != -1){
    int nbit = bit & ~(1 << tar), ntar = dp[bit][tar].second;
    ans.push_back(ntar);
    tar = ntar;
    bit = nbit;
  }
  REVERSE(ans);
  REP(i, ans.size()) cout <<(i != 0 ? " " : "") <<num[ans[i]];
  cout <<endl;
  return 0;
}