#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> index(n);
    vector<int> dist(n);
    vector<int> num(n);
    for(int i=0; i<n; ++i)
        cin >> index[i] >> dist[i] >> num[i];

    vector<int> weight(1<<n, 0);
    vector<vector<double> > time(1<<n, vector<double>(n, DBL_MAX));
    vector<vector<int> > prev(1<<n, vector<int>(n));
    for(int i=0; i<n; ++i){
        weight[1<<i] = num[i] * 20;
        time[1<<i][i] = 0.0;
    }

    for(int i=0; i<(1<<n); ++i){
        bitset<15> bs(i);
        for(int j=0; j<n; ++j){
            if(!bs[j])
                continue;
            for(int k=0; k<n; ++k){
                if(bs[k])
                    continue;
                bs[k] = true;

                double t = time[i][j] + abs(dist[j] - dist[k]) / (2000.0/(70+weight[i]));
                if(t < time[bs.to_ulong()][k]){
                    weight[bs.to_ulong()] = weight[i] + num[k] * 20;
                    time[bs.to_ulong()][k] = t;
                    prev[bs.to_ulong()][k] = j;
                }
                bs[k] = false;
            }
        }
    }

    vector<int> ret(n);
    bitset<15> bs((1<<n)-1);
    int j = min_element(time.back().begin(), time.back().end()) - time.back().begin();
    ret[n-1] = index[j];
    for(int i=n-2; i>=0; --i){
        int k = prev[bs.to_ulong()][j];
        ret[i] = index[k];
        bs[j] = false;
        j = k;
    }

    cout << ret[0];
    for(int i=1; i<n; ++i)
        cout << ' ' << ret[i];
    cout << endl;

    return 0;
}