#include <stdio.h>
#include <vector>
using namespace std;
#define PB push_back
const int N=1e1+10;
const int MAXN=1<<16;
const double INF=1<<30;
int abs(int a){return a>0?a:-a;}
int main(){
    int n,s[N],d[N],v[N],from[MAXN][N],val[MAXN],all,now=0,top;
    vector<int> ans;
    double dp[MAXN][N],temp;
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d%d%d",&s[i],&d[i],&v[i]);
    all=1<<n;
    for(int i=0;i<all;i++){
        val[i]=0;
        for(int j=0;j<n;j++){
            dp[i][j]=INF;
            if(i&(1<<j))val[i]+=v[j];
        }
        val[i]*=20;
    }
    for(int i=0;i<n;i++){
        from[1<<i][i]=-1;
        dp[1<<i][i]=((double)70/2000)*d[i];
    }
    for(int i=0;i<all;i++)for(int j=0;j<n;j++)if(i&(1<<j)){
        for(int k=0;k<n;k++)if(k!=j&&i&(1<<k)){
            temp=dp[i^(1<<j)][k]+((double)(70+val[i^(1<<j)])/2000)*abs(d[j]-d[k]);
            if(dp[i][j]>temp){
                from[i][j]=k;
                dp[i][j]=temp;
            }
        }
    }
    all--;
    top=dp[all][0];
    for(int i=1;i<n;i++)if(dp[all][i]<top){
        top=dp[all][i];
        now=i;
    }
    while(all>0){
        ans.PB(s[now]);
        top=all;
        all-=1<<now;
        now=from[top][now];
    }
    printf("%d",ans.back());
    for(int i=static_cast<int>(ans.size()-2);i>=0;i--)printf(" %d",ans[i]);
    printf("\n");
}
