#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 short 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;
typedef pair <double, VI> DATA;
const LL INF = 10000000000LL;

int n;
LL NO[SIZE], D[SIZE], K[SIZE]; 
LL W[BIT_SIZE]; 
DATA dp1[SIZE][BIT_SIZE];

void init() {
    for ( int i = 0; i < SIZE; ++ i ) {
        for ( int j = 0; j < BIT_SIZE; ++ j ) {
            dp1[i][j] = DATA( INF + 1, VI() );
        }
    }
}

DATA solve( int k, int state, double weight ) {
    DATA res( 0, VI() );
    res.second.push_back( k );
    
    if ( state == (1<<n)-1 ) return res;
    if ( dp1[k][state].first < INF ) return dp1[k][state];

    res.first = INF + 1;
    for ( int i = 0; i < n; ++ i ) {
        if ( ( state & ( 1 << i ) ) != 0 ) continue;
        DATA ret = solve( i, state | ( 1 << i ), weight + K[i] );
        ret.first += abs( D[k] - D[i] ) / ( 2000.0 / ( 70.0 + weight ) );
        if ( res.first > ret.first ) res = ret;
    }

    res.second.insert( res.second.begin(), k );
    return dp1[k][state] = res;
}

void output( DATA data ) {
    for ( int i = 0; i < n; ++ i ) {
        cout << NO[data.second[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];
            K[i] *= 20;
        }
        init();
        DATA res( INF + 1, VI() );
        for ( int i = 0; i < n; ++ i ) {
            DATA ret = solve( i, 1 << i, 0.0 );
            if ( res.first > ret.first ) res = ret;
        }
        output( res );
    }
    return 0;
}