#include <iostream>
#include <cmath>
#include <cstring>
#include <cfloat>
#include <algorithm>
using namespace std;

int id[15], dist[15], ryou[15];
double t[32768][15];
pair<int,int> prv[32768][15];

int main() {
    memset(t, 0, sizeof t);
    int n; cin >> n;
    for (int i=0; i<n; ++i) {
        cin >> id[i] >> dist[i] >> ryou[i];
    }
    int last = (1<<n)-1;
    for (int bt=1; bt<=last; ++bt) {
        for (int i=0; i<n; ++i) {
            if (bt & (1<<i) && bt - (1<<i)) {
                int bt2 = bt - (1<<i);
                t[bt][i] = DBL_MAX;
                int w = 0;
                for (int j=0; j<n; ++j) {
                    if (bt2 & (1<<j)) {
                        w += ryou[j] * 20;
                    }
                }
                for (int j=0; j<n; ++j) {
                    if (bt2 & (1<<j)) {
                        double tt = t[bt2][j] + abs(dist[i] - dist[j]) * (7.0 + w) / 200.0;
                        if (tt < t[bt][i]) {
                            t[bt][i] = tt;
                            prv[bt][i] = make_pair(bt2, j);
                        }
                    }
                }
            }
        }
    }
    double mn = DBL_MAX;
    pair<int,int> key;
    for (int i=0; i<n; ++i) {
        if (t[last][i] < mn) {
            mn = t[last][i];
            key = make_pair(last, i);
        }
    }
    vector<int> res;
    while (0 < key.first) {
        res.push_back(id[key.second]);
        key = prv[key.first][key.second];
    }
    for (int i=n-1; i>=0; --i) {
        cout << (i == n-1 ? "" : " ") << res[i];
    }
    cout << endl;
    return 0;
}