#include <cstdio>
#include <queue>
#include <vector>
#include <cstdlib>
#include <algorithm>
using namespace std;

#define ST 999

class Node
{
public:
	int n,d,s;
	vector<int> to,c;
	Node()
	{}
	
	Node(int n, int d, int s)
	:n(n),d(d),s(s)
	{}
};

class Trl
{
public:
	int p,h,l,w;
	double c;
	Trl(int p, double c, int h, int l, int w)
	:p(p),c(c),h(h),l(l),w(w)
	{}
	
	bool operator<(const Trl& t) const
	{
		return c>t.c;
	}
};

short h[15][1<<15];

int main()
{
	int N;
	scanf("%d", &N);
	Node node[15];
	
	for(int i=0; i<N; i++)
	{
		int n,d,s;
		scanf("%d%d%d", &n,&d,&s);
		
		node[i]=Node(n,d,s);
	}
	
	for(int i=0; i<N; i++)
	for(int j=i+1; j<N; j++)
	{
		int d=abs(node[i].d-node[j].d);
		node[i].to.push_back(j);
		node[j].to.push_back(i);
		node[i].c.push_back(d);
		node[j].c.push_back(d);
	}
	
	priority_queue<Trl> q;
	for(int i=0; i<N; i++)
		q.push(Trl(i,0,(1<<i), ST, node[i].s));

	for(int i=0; i<(1<<15); i++)
	for(int j=0; j<15; j++)
		h[j][i]=-2;
		
	while(1)
	{
		Trl t=q.top(); q.pop();
		if(h[t.p][t.h]!=-2) continue;
		h[t.p][t.h]=t.l;
		
		if(t.h==(1<<N)-1)
		{
			int p=t.p, th=t.h;
			vector<int> paths;
			while(1)
			{
				paths.push_back(node[p].n);
				short tp=h[p][th];
				th^=(1<<p);
				p=tp;
				if(p==ST) break;
			}
			reverse(paths.begin(), paths.end());
			for(int i=0; i<paths.size(); i++)
			{
				if(i!=0) printf(" ");
				printf("%d", paths[i]);
			}
			puts("");
			break;
		}
		
		for(int i=0; i<node[t.p].to.size(); i++)
		{
			int next=node[t.p].to[i];
			if(t.h&(1<<next)) continue;
			
			int th=t.h|(1<<next);
			if(h[next][th]!=-2) continue;
			
			int tw=t.w+node[t.p].s;
			double tc=node[t.p].c[i]*(70+tw*20.0)/(2000.0);
			
			q.push(Trl(next, t.c+tc, th, t.p, tw));
		}
	}
}