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

alias Tuple!(int, "id", double, "dist", double, "weight") House;
alias Tuple!(double, "time", int[], "route") State;

State[][] dp;
House[] houses;

const double INF = double.max;

static this() {
  dp = new State[][](1 << 16, 16);
  foreach(ref d; dp)
    foreach(ref x; d) x.time = INF;
}

// return time
State rec(int v, int used, double weight) {
  State ret = State(0.0, [v]);
  if (used == 0) return ret;
  if (dp[used][v].time != INF) return dp[used][v];
  ret.time = INF;
  foreach(int i, curr; houses) {
    if (((used >> i) & 1) == 1) {
      State state = rec(i, used & ~(1 << i), weight + curr.weight);
      double t =
        abs(houses[v].dist - curr.dist) / (2000.0 / (weight + 70.0)) + state.time;
      if (t < ret.time) {
        ret.time = t;
        ret.route = state.route;
      }
    }
  }
  ret.route ~= v;
  dp[used][v] = ret;
  return ret;
}

void main() {
  int times;
  double m = double.max;
  int used = 0;
  int[] ans;
  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) used |= (1 << i);

  // 探索
  for(int i = 0; i < times; i++) {
    State state = rec(i, used & ~(1 << i), houses[i].weight);
    if (m > state.time) {
      ans = state.route.reverse;
      m =   state.time;
    }
  }

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