#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

struct P{ int number, dist, value; };

const int N = 16;
int n;
double memo[N][1 << N];
int nxt[N][1 << N];

double rec(vector<P>& v, int p, int w, int u, int now)
{
	if(u + 1 == 1 << n) return 0;
	if(memo[now][u] != -1) return memo[now][u];
	
	double min = 1 << 20;
	
	rep(i, n) if(!(u >> i & 1))
	{
		double time = rec(v, v[i].dist, w + v[i].value, u | 1 << i, i + 1) + (w ? 1.0 : 0.0) * abs(v[i].dist - p) * (70 + w * 20) / 2000.0;
		
		if(time < min)
		{
			min = time;
			nxt[now][u] = i + 1;
		}
	}
	
	return memo[now][u] = min;
}

void print(vector<P>& v)
{
	for(int u = 0, p = 0; n--; )
	{
		int x = nxt[p][u];
		
		if(x == 0) sleep(1000000);
		
		cout << v[x - 1].number << (n ? " " : "\n");

		u |= 1 << (x - 1);
		p = x;
	}
}

int main()
{
	cin >> n;
	
	vector<P> v(n);
	rep(i, n) cin >> v[i].number >> v[i].dist >> v[i].value;
	
	rep(i, N) rep(j, 1 << N) memo[i][j] = -1;

	rec(v, 0, 0, 0, 0);
	
	print(v);
}