#include <iostream>
#include <vector>
#include <cstdlib>
#include <climits>

using namespace std;

int n;
const int MAX = 15;
const int SMAX = 1 << MAX;

typedef struct KURA
{
	int id, dist, num;
} KURA;

KURA K[MAX];
double cost[SMAX][MAX];
pair<int, int> p[SMAX][MAX];
int w[SMAX];

double get_cost(int i, int j, int s)
{
	return abs(K[i].dist - K[j].dist) / (2000.0 / (70.0+w[s]));
}

void solve()
{
	int smax = 1 << n;

	for(int s=1; s<smax; s++)
	{
		int sum = 0;
		for(int i=0; i<n; i++)
		{
			if(s&(1<<i))
				sum += K[i].num * 20;
		}
		w[s] = sum;
	}

	for(int i=0; i<smax; i++)
	{
		for(int j=0; j<n; j++)
		{
			cost[i][j] = INT_MAX;
			p[i][j] = make_pair(-1, -1);
		}
	}

	for(int i=0; i<n; i++)
	{
		cost[1<<i][i] = 0;
	}

	for(int s=0; s<smax; s++)
	{
		for(int i=0; i<n; i++)
		{
			if(!((1<<i) & s)) continue;

			for(int j=0; j<n; j++)
			{
				if((1<<j) & s) continue;

				//i is visited, j is not visited.
				double new_cost = cost[s][i] + get_cost(i, j, s);

				if(cost[s | (1<<j)][j] > new_cost)
				{
					cost[s | (1<<j)][j] = new_cost;
					p[s | (1<<j)][j] = make_pair(s, i);
				}

			}
		}
	}

	int end = 0;
	for(int i=0; i<n; i++)
	{
		if(cost[smax-1][i] < cost[smax-1][end])
		{
			end = i;
		}
	}

	pair<int, int> pre = make_pair(smax-1, end);
	int path[MAX];
	for(int i=0; pre.first!=-1; pre = p[pre.first][pre.second], i++)
	{
		path[i] = K[pre.second].id;
	}

	for(int i=0; i<n; i++)
	{
		if(i) cout << " ";
		cout <<  path[n-i-1];
	}
	cout << endl;
}

int main(int argc, char** argv)
{
	cin >> n;

	for(int i=0; i<n; i++)
	{
		cin >> K[i].id >> K[i].dist >> K[i].num;
	}

	solve();
}