n = gets.to_i
dp = Array.new(n) { Array.new n }
ss = n.times.map { s, d, v = gets.split.map(&:to_i); [s, d, 20 * v] }
if n == 1
  p ss[0][0]
  exit
end
encode = lambda do |xs|
  xs.reduce 0 do |r, x|
    r | (1 << x)
  end
end
dist = lambda {|a, b, w| (a[1] - b[1]).abs * (70 + w) / 2000.0 }
puts n.times.map {
  cs = Array.new(2**(n-1)) { Array.new n-1, Float::INFINITY }
  ws = Array.new(2**(n-1)) { Array.new n-1 }
  ps = Array.new(2**(n-1)) { Array.new n-1 }
  s0, *ss = ss
  ss.each_with_index do |s, i|
    e = encode[[i]]
    ws[e] = s0[2] + s[2]
    cs[e][i] = dist[s0, s, s0[2]]
  end
  for i in 2..n-1
    [*0...n-1].combination(i) do |ks|
      #e = encode[ks]
      e = ks.reduce(0) {|r, x| r | (1 << x) }
      ws[e] = ws[e - (1 << ks[0])] + ss[ks[0]][2]
      ks.each do |k|
        f = e - (1 << k)
        ks.each do |i|
          next if i == k
          #c = cs[f][i] + dist[ss[i], ss[k], ws[f]]
          c = cs[f][i] + (ss[i][1] - ss[k][1]).abs * (70 + ws[f]) / 2000.0
          if c < cs[e][k]
            cs[e][k] = c
            ps[e][k] = i
          end
        end
      end
    end
  end
  e = encode[(n-1).times.to_a]
  k = (n-1).times.min_by {|i| cs[e][i] }
  c = cs[e][k]
  rs = []
  loop do
    rs << ss[k][0]
    break unless ps[e][k]
    e, k = e - (1 << k), ps[e][k]
  end
  ss << s0
  rs << s0[0]
  [c, rs.reverse!]
}.min_by(&:first)[1].join ' '