#include <bits/stdc++.h>

using namespace std;

int N;
int Id[15], Dist[15], Weight[15];
int DpWeight[1 << 15], traceInfo[15][1 << 15];
double DpTime[15][1 << 15];

double getTime(double dist, double weight) {
	return dist * (70 + weight) / 2000.0;
}

double judge(int now, int visited) {
	double curTime,resTime;

	if (DpTime[now][visited] != -1) {
		return DpTime[now][visited];
	}
	if (visited == (1 << N) - 1) {
		return 0;
	}

	resTime = DBL_MAX;
	for (int i = 0; i < N; ++i) {
		if (((visited >> i) & 1) == 1) {
			continue;
		}
		curTime = judge(i, visited^(1<<i)) + getTime(abs(Dist[i] - Dist[now]), DpWeight[visited]);
		if (curTime < resTime) {
			resTime = curTime;
			traceInfo[now][visited] = i;
		}
	}

	return DpTime[now][visited] = resTime;
}

void solve(int limit) {
	int id;
	double timeMin, curTime;

	for (int i = 0; i < N; ++i) {
		fill(DpTime[i], DpTime[i] + limit, -1);
	}

	timeMin = DBL_MAX;
	for (int i = 0; i < N; ++i) {
		curTime = judge(i, 1 << i);
		if (curTime < timeMin) {
			timeMin = curTime;
			id = i;
		}
	}

	--limit;
	cout << Id[id];
	for (int i = 1 << id; i < limit; i^=(1<<id)) {
		id = traceInfo[id][i];
		cout << " " << Id[id];
	}
	cout << endl;
}

int main() {
	int limit;

	memset(DpWeight, 0, sizeof(DpWeight));
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> Id[i] >> Dist[i] >> Weight[i];
	}

	limit = 1 << N;
	for (int i = 1; i < limit; ++i) {
		for (int j = 0; j < N; ++j) {
			if (((i >> j) & 1) == 1) {
				DpWeight[i] += Weight[j] * 20;
			}
		}
	}
	solve(limit);

	return 0;
}
