import std.stdio, std.typecons, std.math;
alias Tuple!(double, "v", string, "path") Tsp; 

Tsp[1 << 15][16] memo;
int[16] dist;
int[16] num;
string[16] id;
int n;

void main(){
	readf("%d\n", &n);
	foreach (i; 0..16) {
		foreach (ref j; memo[i]) {
			j.v = -1;
			j.path = "";
		}
		if (i < n) readf("%s %s %s\n", &id[i], &dist[i], &num[i]);
	}
	num[15] = 0;
	id[15] = "ignore";
	writeln(tsp(15, 0, 0).path[7..$]);
}

Tsp tsp(int p, int b, int w){
	if (memo[p][b].v != -1) return memo[p][b];
	if (b == (1 << n) -1) return Tsp(0, id[p]);

	Tsp res = Tsp(double.max, "ignore");
	Tsp tmp;
	foreach (i; 0..n) {
		if (b & (1 << i)) continue;
		tmp = tsp(i, b | (1 << i), w+num[p]);
		double value = cost(p, i, w+num[p]) + tmp.v;
		if (res.v > value) {
			res.v = value;
			res.path = id[p] ~ " " ~ tmp.path;
		}
	}
	memo[p][p] = res;
	return res;
}

double cost(int from, int to, int w){
	if (from == 15) return 0;
	return abs(dist[to] - dist[from])*(70.0+w*20.0) / 2000.0;
}