#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;
const int INF = (int)1e8;

int n;
int id[17],m[17],w[17];

double dp[1<<16][16];
int dp_last[1<<16][16];

double dfs(int S,int v,int we){
	if(dp[S][v] != 1e300) return dp[S][v];
	if(S == (1 << n) - 1) return dp[S][v] = 0.0;

	double ret = 1e300;
	int last = -1;
	FOR(i,n){
		if(!(S & (1 << i))){
			double val = dfs(S | (1 << i),i,we + w[i]);
			int len = abs(m[v] - m[i]);
			val += len / (2000.0 / (70 + we * 20));
			if(ret > val){
				ret = val;
				last = i;
			}
		}
	}

	dp_last[S][v] = last;
	return dp[S][v] = ret;
}

int main(){
	cin>>n; FOR(i,n) cin>>id[i]>>m[i]>>w[i];
	
	FOR(i,1<<16) FOR(j,16){
		dp[i][j] = 1e300;
	}

	dfs(0,n,0);

	int last = dp_last[0][n];
	int S = (1<<last);
	vector<int> ans;
	ans.push_back(last);
	while(S != (1<<n) - 1){
		last = dp_last[S][last];
		S |= (1 << last);
		ans.push_back(last);
	}

	FOR(i,n){
		printf("%d%c",id[ans[i]],i==n-1?'\n':' ');
	}

	return 0;
}