#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

double memo[1<<15][15];
int prev[1<<15][15];
double speed[1<<15];
int dist[15];
int weight[15];
int id[15];
int N;

double solve(int state, int pos) {
    double &res = memo[state][pos];
    if(res >= 0) return res;

    res = 1e30;
    const int prev_state = state & ~(1<<pos);
    for(int i = 0; i < N; ++i) {
        const int mask = 1<<i;
        if(prev_state & mask) {
            const double t = solve(prev_state, i) + abs(dist[pos]-dist[i]) / speed[prev_state];
            //cout << state << ' ' << pos << ' ' << i << ' ' << t << endl;
            if(t < res) {
                res = t;
                prev[state][pos] = i;
            }
        }
    }
    //cout << state << ' ' << pos << ' ' << res << endl;
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    cin >> N;
    for(int i = 0; i < N; ++i) {
        cin >> id[i] >> dist[i] >> weight[i];
    }
    const int TERMINAL = (1<<N)-1;
    for(int i = 0; i <= TERMINAL; ++i) {
        for(int j = 0; j < N; ++j) {
            memo[i][j] = (i == (1<<j)) ? 0 : -1;
            prev[i][j] = -1;
        }
    }
    for(int i = 0; i <= TERMINAL; ++i) {
        int sum = 0;
        for(int j = 0; j < N; ++j) {
            if(i & (1<<j)) sum += weight[j];
        }
        speed[i] = 2000.0 / (70+sum*20);
        //cout << speed[i] << endl;
    }
    for(int i = 0; i < N; ++i) {
        solve(TERMINAL, i);
    }
    int cur = 0;
    for(int i = 1; i < N; ++i) {
        if(memo[TERMINAL][i] < memo[TERMINAL][cur]) {
            cur = i;
        }
    }
    int state = TERMINAL;
    vector<int> ans;
    while(cur != -1) {
        ans.push_back(id[cur]);
        int next = prev[state][cur];
        state &= ~(1<<cur);
        cur = next;
    }
    reverse(ans.begin(), ans.end());
    for(int i = 0; i < N; ++i) {
        if(i > 0) cout << ' ';
        cout << ans[i];
    }
    cout << endl;
    return 0;
}