// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int N, S[20], D[20], V[20];
double dp[1 << 15][15];
vector<int> vec[1 << 15][15];
 
signed main() {
    cin >> N;
    for(int i=0; i<N; i++) {
        cin >> S[i] >> D[i] >> V[i];
    }

    fill(dp[0], dp[1<<N], INF);
    dp[0][0] = 0;

    for(int bit=0; bit<(1<<N); bit++) {
        for(int k=0; k<N; k++) {
            if(dp[bit][k] == INF) continue;

            int weight = 0;
            for(int i=0; i<N; i++) {
                if(bit >> i & 1) weight += V[i] * 20;
            }
            for(int i=0; i<N; i++) {
                if(bit >> i & 1) continue;
                else {
                    int nbit = bit | (1 << i);
                    int pre = (bit ? D[k] : 0);
                    int dist = abs(D[i] - pre);

                    double cost = dist / (2000.0 / (70 + weight));
                    if(dp[nbit][i] > dp[bit][k] + cost) {
                        dp[nbit][i] = dp[bit][k] + cost;
                        vec[nbit][i] = vec[bit][k];
                        vec[nbit][i].push_back(S[i]);
                    }
                }
            }
        }
    }
    
    vector<int> ans;
    double rec = INF;
    for(int i=0; i<N; i++) {
        if(rec > dp[(1<<N)-1][i]) {
            rec = dp[(1<<N)-1][i];
            ans = vec[(1<<N)-1][i];
        }
    }

    for(size_t i=0; i<ans.size(); i++) {
        cout << ans[i] << " \n"[i+1==ans.size()];
    }
    return 0;
}
