#include <iostream>
#include <cstdlib>
using namespace std;

struct Storage {
    int num, distance, money;
    bool isVisited;
};

Storage storages[15];
int route[15];
int ans[15];
int visitedNum;
double minTime;
int n;

void solve(int index, int weight, int position, double time) {
    double speed = (double) 2000 / (70 + weight),
        dist = (double) abs(position - storages[index].distance) / speed;
    time += dist / speed;
    weight += storages[index].money * 20;
    storages[index].isVisited = true;
    route[visitedNum++] = index;
    if (visitedNum < n) {
        for (int i = 0; i < n; i++) {
            if (storages[i].isVisited == false) {
                solve(i, weight, storages[index].distance, time);
            }
        }
    } else {
        if (time < minTime) {
            for (int i = 0; i < n; i++) {
                ans[i] = route[i];
            }
            minTime = time;
        }
    }
    visitedNum--;
    int num = route[visitedNum];
    route[visitedNum] = 0;
    storages[num].isVisited = false;
    return;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> storages[i].num >> storages[i].distance >> storages[i].money;
        storages[i].isVisited = false;
    }
    visitedNum = 0;
    minTime = 100000000;
    for (int i = 0; i < n; i++) {
        solve(i, 0, 0, 0);
    }
    bool insertSpace = false;
    for (int i = 0; i < n; i++) {
        if (insertSpace) {
            cout << " ";
        } else {
            insertSpace = true;
        }
        cout << storages[ans[i]].num;
    }
    cout << endl;
}