#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef long long INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


typedef long long LL;
const int SIZE = 16;
const int BIT_SIZE = 1 << SIZE;

int n;
LL NO[SIZE], D[SIZE], K[SIZE]; 
LL W[BIT_SIZE]; 
double dp1[SIZE][BIT_SIZE];
VI dp2[SIZE][BIT_SIZE];
double minCost;
VI minPath;

void init() {
    minCost = -1.0;
    fill( (double*)dp1, (double*)dp1 + SIZE*BIT_SIZE, -1.0 );
    fill( (VI*)dp2, (VI*)dp2 + SIZE*BIT_SIZE, VI() );
}

double solve( int k, int state, double weight ) {
    VI& path = dp2[k][state];
    path = VI();
    path.push_back( k );
    if ( state == (1<<n)-1 ) return 0.0;
    
    double& res = dp1[k][state];
    if ( res > -0.5 ) return res;

    VI cand;
    res = INT_MAX;
    for ( int i = 0; i < n; ++ i ) {
        int bi = 1 << i;
        if ( ( state & bi ) != 0 ) continue;
        int newState = state | bi;
        double ret = solve( i, newState, weight + K[i] );
        double newCost = ret + (double)abs( D[k] - D[i] ) / ( 2000.0 / ( 70.0 + weight ) );
        if ( newCost < res ) {
            res = newCost;
            path = dp2[i][newState];
        }
        res = min( res, newCost );
    }

    path.insert( path.begin(), k );
    return res;
}

void output() {
    for ( int i = 0; i < n; ++ i ) {
        cout << NO[minPath[i]];
        if ( i + 1 < n ) cout << " ";
    }
    cout << endl;
}

int main() {
    while ( cin >> n ) {
        for ( int i = 0; i < n; ++ i ) {
            cin >> NO[i] >> D[i] >> K[i];
        }
        for ( int i = 0; i < (1<<n); ++ i ) {
            int w = 0;
            for ( int j = 0; j < n; ++ j ) {
                if ( ( i & ( 1 << j ) ) == 0 ) continue;
                w += K[j];
            }
            W[i] = w * 20;
        }
        init();
        for ( int i = 0; i < n; ++ i ) {
            double cost = solve( i, 1 << i, 0.0 );
            if ( minCost < 0.0 ) {
                minCost = cost;
                minPath = dp2[i][1<<i];
            }
            if ( cost < minCost ) {
                minCost = cost;
                minPath = dp2[i][1<<i];
            }
        }
        output();
    }
    return 0;
}