#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 21474836000000

int main(){
  int n;
  cin>>n;
  vector<int> s(n), d(n), v(n);
  rep(i,n) cin>>s[i]>>d[i]>>v[i];

  vector<vector<double>> dp(1<<n, vector<double>(n, INF));
  vector<vector<int>> prev(1<<n, vector<int>(n,-1));
  rep(i,n) dp[1<<i][i] = 0;
  repl(mask, 1, 1<<n){
    double tw = 70;
    rep(i,n) if(mask&(1<<i)) tw += v[i];
    double vv = 2000.0 / tw;
    rep(i,n) if(dp[mask][i]<INF){
      rep(j,n) if((mask&(1<<j))==0){
        double t = dp[mask][i] + abs(d[i]-d[j])/vv;
        int nmask = mask | (1<<j);
        if(dp[nmask][j] > t){
          dp[nmask][j] = t;
          prev[nmask][j] = i;
        }
      }
    }
  }

  double best=INF;
  int besti;
  int mask = (1<<n) -1;
  rep(i,n) if(best > dp[mask][i]) {best = dp[mask][i]; besti = i;}
  vector<int> res;
  while(besti!=-1){
    int i = besti;
    besti = prev[mask][i];
    mask = mask - (1<<i);
    res.pb(s[i]);
  }
  reverse(all(res));
  rep(i,n) printf("%d%c", res[i], " \n"[i==n-1]);

  return 0;
}