# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;

# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<" :"<<x<<endl;
# define EPS 1e-12



template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };

typedef pair< double, vi > pdv;
int n;
int dis[17] = {}, num[17] = {}, vol[17] = {};
pdv memo[1 << 15][16];

double calcw(int bit)
{
	double ans = 0.0;
	for (int i = 0; i < n; i++)
	{
		if (bit & 1 << i)ans += vol[i] * 20.0;
	}
	return ans;
}

pdv dp(int bit, int prev)
{
	if (__popcnt(bit) == n)return pdv(0.0, {});
	if (memo[bit][prev].first >= 0.0)return memo[bit][prev];

	double w = calcw(bit);
	double speed = 2000.0 / (70.0 + w);
	pdv ans(9999999999.0, {});
	for (int i = 0; i < n; i++)
	{
		if (bit & 1 << i)continue;
		pdv s = dp(bit | 1 << i, i);
		s.first += 1.0*abs(dis[i] - dis[prev]) / speed;
		if (ans.first > s.first)
		{
			ans = s;
			ans.second.push_back(num[i]);
		}
	}

	return memo[bit][prev] = ans;
}
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> num[i] >> dis[i] >> vol[i];
	}
	for (int i = 0; i < 1 << 15; i++)
	{
		for (int j = 0; j < 16; j++)
		{
			memo[i][j] = pdv(-1.0, {});
		}
	}
	pdv ans = dp(0, n);
	reverse(ALL(ans.second));
	for (int i = 0; i < n; i++)
	{
		if (i)cout << " ";
		cout << ans.second[i];
	}
	cout << endl;
}