//29
#include<iostream>
#include<queue>
#include<vector>
#include<cstdlib>

using namespace std;

struct S{
  int w,f,i;
  double t;
  vector<int> v;
  bool operator<(S a)const{
    return t>a.t;
  }
};

int main(){
  int n;
  cin>>n;
  int k[15],d[15],s[15];
  for(int i=0;i<n;i++){
    cin>>k[i]>>d[i]>>s[i];
  }
  priority_queue<S> que;
  for(int i=0;i<n;i++){
    S is;
    is.t=0;
    is.f=1<<i;
    is.i=i;
    is.w=s[i];
    is.v.push_back(k[i]);
    que.push(is);
  }
  bool p[1<<15][15]={{}};
  for(;;){
    S c=que.top();
    if(c.f==(1<<n)-1)break;
    que.pop();
    if(p[c.f][c.i]++)continue;
    for(int i=0;i<n;i++){
      S n=c;
      n.t+=abs(d[c.i]-d[i])/(2000./(70+c.w*20));
      n.f|=1<<i;
      n.i=i;
      n.w+=s[i];
      n.v.push_back(k[i]);
      if(!p[n.f][n.i]){
	que.push(n);
      }
    }
  }
  for(int i=0;i<n;i++){
    cout<<que.top().v[i]<<((i==n-1)?'\n':' ');
  }
  return 0;
}