#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

typedef pair<double, vector<int> > P;

const int MAX_N = 15;
const double INF = 999999999.0;

int n;
int no[MAX_N], x[MAX_N], w[MAX_N];
P dp[MAX_N][1 << MAX_N];

P solve(int v, int S, int weight)
{
    P res(0.0, vector<int>());
    res.second.push_back(no[v]);
    
    if(S == (1 << n) - 1) 
        return res;
    if(dp[v][S].first != INF)
        return dp[v][S];

    res.first = INF;
    for(int u = 0; u < n; u++) {
        if(!(S >> u & 1)) {
            P tmp = solve(u, S | 1 << u, weight + w[u]);
            tmp.first += abs(x[v] - x[u]) / (2000.0 / (70 + weight));
            if(res.first > tmp.first) {
                res = tmp;
            }
        }
    }

    res.second.insert(res.second.begin(), no[v]);

    return dp[v][S] = res;
}

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> no[i] >> x[i] >> w[i];
        w[i] *= 20;
    }

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < (1 << n); j++) {
            dp[i][j] = P(INF, vector<int>());
        }
    }

    P ans(INF, vector<int>());
    for(int v = 0; v < n; v++) {
        P tmp = solve(v, 1 << v, w[v]);
        if(ans.first > tmp.first) ans = tmp;
    }

    for(int i = 0; i < n - 1; i++) 
        cout << ans.second[i] << " ";
    cout << ans.second[n-1] << endl;

}