#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <bitset>
#include <string>
using namespace std;

#define PI 3.14159265358979

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int N;
const int MAX_N = 15;
const int N_STATE = 1<<15;
int n[MAX_N], d[MAX_N], s[MAX_N];

const double INF = 1.0e10; 
bitset<MAX_N> visited;
int dp[N_STATE][MAX_N];
vi  path[N_STATE][MAX_N];

void dfs(int k, vi& p, double t, int w) {
	int state = visited.to_ulong();
	if(dp[state][k] >= 0 && dp[state][k] <= t) return;
	dp[state][k] = t;
	path[state][k] = p;

	if(visited.count() == N) return;

	rep(i,N) {
		if(!visited[i]) {
			double e = abs(d[i] - d[k]) / (2000.0 / (70.0 + w));
			visited.set(i);
			p.push_back(i);
			dfs(i, p, t+e, w+s[i]*20);
			p.pop_back();
			visited.reset(i);
		}
	}
}

void solve() {
	memset(dp, -1, sizeof(dp));

	int last = (1<<N) - 1;
	double minval = INF;
	vi p, ans;
	rep(i,N) {
		visited.set(i);
		p.push_back(i);
		dfs(i, p, 0, s[i]*20);
		p.pop_back();
		visited.reset(i);

		rep(j,N) {
			if(dp[last][j] >= 0 && minval > dp[last][j]) {
				minval = dp[last][j];
				ans = path[last][j];
			}
		}
	}

	if(ans.size() == N) {
		rep(i,N) {
			printf("%d ", n[ans[i]]);
		}
		printf("\n");
	} else {
		printf("%ld\n", ans.size());
	}
}

int main() {
	cin>>N;
	rep(i,N) {
		cin>>n[i]>>d[i]>>s[i];
	}
	solve();
}