#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
double F(int l1, int l2, int c)
{
	return abs(l1-l2)/(2000.0/(70+20.*c));
}
struct S{double t;int c,i;}dp[1<<15][15],x={1e9,-1,-1};
bool Cmp(const S&l,const S&r){return l.t<r.t;}
int main()
{
	std::fill(dp[0],dp[1<<15],x);

	int n,index[15],l[15],c[15],i,j,k;
	scanf("%d",&n);
	for(i=0;i<n;++i)
	{
		scanf("%d%d%d",&index[i],&l[i],&c[i]);
		dp[1<<i][i].t=0;
		dp[1<<i][i].c=c[i];
		dp[1<<i][i].i=i;
	}
	std::vector<int>u,v;
	for(i=1;i<(1<<n);++i)
	{
		u.clear();
		v.clear();
		for(j=0;j<n;++j)
			if(!(i&(1<<j)))v.push_back(j);
			else u.push_back(j);
		for(j=0;j<v.size();++j)
		{
			int b=v[j];
			for(k=0;k<u.size();++k)
			{
				int f=u[k];
				S&r=dp[i|(1<<b)][b];
				double T=dp[i][f].t+F(l[b],l[f],dp[i][f].c);
				if(r.t>T)
				{
					r.t=T;
					r.i=f;
					r.c=dp[i][f].c+c[b];
				}
			}
		}
	}
	v.clear();
	i=(1<<n)-1;
	k = std::min_element(dp[i],&dp[i][n],Cmp)-dp[i];
	for(i=(1<<n)-1;i;)
	{
		v.push_back(k);
		j = dp[i][k].i;
		i^=(1<<k);
		k = j;
	}
	for(i=v.size()-1;i>=0;--i)printf("%d%c",index[v[i]],i?' ':'\n');
	return 0;
}