import std.stdio, std.typecons, std.math,
  std.algorithm, std.conv, std.string;

alias Tuple!(int, "id", double, "dist", double, "weight") House;

ulong[] comb;
double time;

void min_time(House[] houses, double prev_dist, double weight,
              double curr_time, ulong[] curr_comb, int mask) {
  if (mask == 0 && curr_time < time) {
    time = curr_time;
    comb = curr_comb;
  }
  foreach(i, curr; houses) {
    if (((mask >> i) & 1) == 1) {
      double t = (abs(prev_dist - curr.dist) * (curr.weight + weight + 70.0) / 2000);
      min_time(houses, curr.dist, curr.weight + weight,
               curr_time + t, curr_comb ~ [i], mask & ~(1 << i));
    }
  }
}

void main() {
  int times;
  House[] houses;
  int mask = 0;
  scanf("%d", &times);
  foreach(t; 0..times) {
    int weight, dist, id;
    scanf("%d %d %d", &id, &dist, &weight);
    houses ~= House(id, dist.to!double, weight.to!double * 20.0);
  }
    
  // 初期化
  foreach(i, h; houses) mask |= (1 << i);
  time = double.max;
  comb = [];

  // 探索
  min_time(houses, 0.0, 0.0, 0.0, [], mask);

  // 表示
  writeln(comb.map!((x) => houses[x].id.to!string).join(" "));
}