#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<functional>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<cfloat>
using namespace std;

class Store {
public:
    double distance, gold;
    Store(double d, double g) :distance(d), gold(g) {}
};

enum {COST, GOLD, ID, PATH};
typedef tuple<double, double, int, vector<int>> Node;

double upperbound;

vector<int> bfs(const vector<Store>& store, int start) {
    int n = store.size();
    vector<int> tmp;
    tmp.push_back(start);

    priority_queue<Node, vector<Node>, greater<Node>> q;
    q.push(Node(0.0, 0.0, start, tmp));
    tmp.pop_back();
    while(!q.empty()) {
        Node current = q.top(); q.pop();
        if(get<COST>(current) >= upperbound) break;
        if(get<PATH>(current).size() == n) {
            upperbound = get<COST>(current);
            return get<PATH>(current);
        }
        for(int i = 0; i < n; ++i) {
            vector<int> path = get<PATH>(current);
            if(find(path.begin(), path.end(), i) != path.end()) continue;
            int id = get<ID>(current);
            double gold = get<GOLD>(current);
            double cost = get<COST>(current);
            gold += store[id].gold;
            cost += fabs(store[id].distance - store[i].distance) * (70.0 + gold) / 2000.0;
            path.push_back(i);
            q.push(Node(cost, gold, i, path));
        }
    }
    return tmp;
}

int main() {
    int n;
    cin >> n;

    vector<Store> store;
    map<int, int> id;
    for(int i = 0; i < n; ++i) {
        int no;
        double distance, gold;
        cin >> no >> distance >> gold;
        id[id.size()] = no;
        store.push_back(Store(distance, gold * 20.0));
    }

    vector<int> answer;
    upperbound = DBL_MAX;
    for(int i = 0; i < n; ++i) {
        vector<int> result = bfs(store, i);
        if(!result.empty()) answer = result;
    }
    for(int i = 0; i < answer.size(); ++i) cout << (i == 0 ? "" : " ") << id[answer[i]];
    cout << endl;
}