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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const double EPS = 1e-8;
const double INF = 1e48;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
double speed(double w){
  return 2000.0 / (70 + w);
}

int main(){
  int N;
  string ID[16];
  double dist[16];
  double weight[16];
  while(cin >> N){
    REP(i, N){
      cin >> ID[i] >> dist[i] >> weight[i];
      weight[i] *= 20;
    }
    static double dp[1 << 16][16] = {};
    static int prev[1 << 16][16] = {};
    REP(i, 1 << N) REP(j, N) dp[i][j] = INF;
    REP(i, 1 << N) REP(j, N) prev[i][j] = -1;
    REP(i, N) dp[1 << i][i] = dist[i] / speed(0);
    REP(S, 1 << N)REP(i, N) if(S >> i & 1) {
      double w = 0;
      REP(j, N) if(S >> j & 1) w += weight[j];
      REP(j, N) if(0 == (S >> j & 1)){
        if(dp[S | 1 << j][j] > dp[S][i] + abs(dist[i] - dist[j]) / speed(w)){
          dp[S | 1 << j][j] = dp[S][i] + abs(dist[i] - dist[j]) / speed(w);
          prev[S | 1 << j][j] = i;
        }
      }
    }
    int min_i = 0;
    REP(i, N) if(dp[(1 << N) - 1][min_i] > dp[(1 << N) - 1][i]) min_i = i;
    int cur_S = (1 << N) - 1;
    int cur_i = min_i;
    vector<string> ans;
    while(cur_i != -1){
      ans.push_back(ID[cur_i]);
      cur_S = cur_S & ~(1 << cur_i);
      cur_i = prev[cur_S | 1 << cur_i][cur_i];
    }
    reverse(ans.begin(), ans.end());
    REP(i, ans.size()){
      cout << ans[i];
      if(i != ans.size() - 1) cout << " ";
      else cout << endl;
    }
  }
  return 0;
}