#include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr double inf = 1000000000 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
int numofbits5(long bits)
{
  bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
  bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
  bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
  bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
  return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}
string e = "";
pair<string,pair<double,int>> dp[(2<<15)+1],ans = make_pair(e,make_pair(inf,0));
array<int,15> d,m,num;
void init(){
  rep(i,(2<<15)+1){
    dp[i] = make_pair(e,make_pair(inf,0));
  }
  fill(all(d),0);
  fill(all(m),0);
}
std::string to_binString(unsigned int val)
{
  if( !val )
    return std::string("0");
  std::string str;
  while( val != 0 ) {
    if( (val & 1) == 0 )
      str.insert(str.begin(), '0');
    else
      str.insert(str.begin(), '1');
    val >>= 1;
  }
  return str;
}

ll n;
void bitdp(int k){
  if(k == (1 << n) -1){
    if(ans.se.fi > dp[k].se.fi){
      ans = dp[k];
    }
    return ;
  }
  rep(i,n){
    if(! (k & (1 << i))){
      string s = dp[k].fi ;
      ll dis = abs(d[s.back()-'a'] - d[i]);
      int w = (dp[k].se.se);
      double t = dp[k].se.fi + dis/(2000.0/(70+w*20));
      w += m[i];
      s += char('a'+i);
      dp[k|(1<<i)] = make_pair(s,make_pair(t,w));
      bitdp(k|(1<<i));
    }
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  init();
  cin >> n;
  rep(i,n){
    cin >> num[i] >> d[i] >> m[i];
  }
  rep(i,n){
    string s ;
    s += ('a'+i);
    dp[(1 << i)] = make_pair(s,make_pair(0,m[i]));
    bitdp((1 << i));
  }
  rep(i,ans.fi.size()){
    if(i) cout << ' ';
    cout << num[ans.fi[i]-'a'] ;
  }
  cout << endl;
  return 0;
}