import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    auto n = readInt();
    long[] d, v, s;
    foreach(i; iota(n)) {
        int si, di, vi;
        readlnTo(si, di, vi);
        s ~= si;
        d ~= di;
        v ~= vi;
    }
    auto dpt = new double[][](1<<n, n);
    auto dpb = new int[][](1<<n, n);
    const double inf = 1e9;
    foreach(i; iota(n)) {
        dpt[0][i] = 0;
    }
    foreach(i; iota(1, 1<<n)) {
        foreach(j; iota(n)) {
            dpt[i][j] = inf;
        }
    }

    long weight(int b) {
        long ans;
        foreach(i; iota(n)) {
            if(b & (1<<i)) {
                ans += v[i] * 20;
            }
        }
        return ans;
    }
    double time(int i, int j, int b) {
        auto dist = abs(d[i] - d[j]);
        return dist * (70. + weight(b)) / 2000;
    }

    foreach(i; iota(1, 1<<n)) {
        foreach(j; iota(n)) {
            if(!(i & (1 << j))) {
                continue;
            }
            auto bb = i&~(1<<j);
            foreach(k; iota(n)) {
                double t = dpt[bb][k] + time(k, j, bb);
                if(dpt[i][j] > t) {
                    dpt[i][j] = t;
                    dpb[i][j] = k;
                }
            }
        }
    }
    int minIdx;
    foreach(i; iota(n)) {
        if(dpt[(1<<n)-1][i] < dpt[(1<<n)-1][minIdx]) {
            minIdx = i;
        }
    }
    int[] ans;
    int b = (1<<n)-1;
    while(b != 0) {
        ans ~= minIdx;
        auto nextIdx = dpb[b][minIdx];
        auto nextB = b & ~(1<<minIdx);
        minIdx = nextIdx;
        b = nextB;
    }
    ans.retro.map!(a => s[a]).map!(to!string).join(" ").writeln();
}