#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;

typedef struct
{
  int idx, dist, num;
} Store;

int n;
double min_time, dp[1 << 15][15];
vector<int> ans;

void solve(int S, int p, int w, double t, vector<int>& path, const vector<Store>& store, const vector<vector<int> >& dist)
{
  if (S == (1 << n)-1) {
    if (t < min_time) {
      min_time = t;
      ans = path;
    }
    return;
  }

  if (dp[S][p] != -1.0)
    return;

  dp[S][p] = t;
  for (int i = 0; i < n; ++i) {
    if (!(S & (1 << i))) {
      path.push_back(store[i].idx);
      double tt = dist[p][i] / ((2000.0 /(70.0+20.0*w))/60.0);
      solve(S | (1 << i), i, w+store[i].num, t+tt, path, store, dist);
      path.pop_back();
    }
  }
  return;
}

int main()
{
  while (cin >> n) {
    vector<Store> store(n);
    for (int i = 0; i < n; ++i)
      cin >> store[i].idx >> store[i].dist >> store[i].num;

    vector<vector<int> > dist(n+1, vector<int>(n+1, 0));
    for (int i = 0; i < n; ++i) {
      for (int j = i+1; j < n; ++j)
	dist[i][j] = dist[j][i] = abs(store[i].dist-store[j].dist);
      dist[n][i] = 0;
    }

    min_time = 1e10;
    ans.clear();
    vector<int> tmp;
    for (int i = 0; i < (1 << 15); ++i) {
      for (int j = 0; j < 15; ++j)
	dp[i][j] = -1.0;
    }
    solve(0, n, 0, 0.0, tmp, store, dist);
    for (int i = 0; i < ans.size()-1; ++i)
      cout << ans[i] << " ";
    cout << ans.back() << endl;
  }
  return 0;
}