#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>

#define f first
#define s second
#define mp make_pair

#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()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int prevs[1<<15][15];
int id[15];
int pos[15];
int num[15];

int main(){
  int n;
  scanf("%d",&n);
  REP(i,n){
    scanf("%d%d%d",id+i,pos+i,num+i);
    num[i] *= 20;
  }
  //time, flag, weight, pos, prev
  typedef pair<double,pair<int,pair<int,pair<int,int> > > > data;
  priority_queue<data,vector<data>,greater<data> > pq;

  memset(prevs, -1, sizeof(prevs));

  REP(i,n){
    int f = ((1<<n)-1) ^ (1<<i);
    pq.push(mp(0.0,mp(f,mp(num[i],mp(i,n)))));
  }

  while(true){
    data d = pq.top();
    double time = d.f;
    int flag    = d.s.f;
    int weight  = d.s.s.f;
    int p       = d.s.s.s.f;
    int prev    = d.s.s.s.s;

    pq.pop();

    if(prevs[flag][p] != -1) continue;
    prevs[flag][p] = prev;

    if(flag == 0){
      REP(i,n){
        printf("%d%c",id[p],i==n-1?'\n':' ');
        prev = prevs[flag][p];
        flag = flag ^ (1<<p);
        p = prev;
      }
      break;
    }

    REP(i,n){
      if(flag & (1<<i)){
        //time, flag, weight, pos, prev
        double tt = time + (double)abs(pos[p] - pos[i]) / weight;
        int ww = weight + num[i];
        int ff = flag ^ (1<<i);
        pq.push(mp(tt,mp(ff,mp(ww,mp(i,p)))));
      }
    }
  }
  return 0;
}