n = $<.gets.to_i
@kuras = $<.readlines.map {|i| i.split.map(&:to_i)}
@kuras.each {|k| k[2] *= 20}

@edges = Array.new(n) {[nil] * n}
n.times do |i|
  (i + 1...n).each {|j| @edges[i][j] = @edges[j][i] = (@kuras[i][1] - @kuras[j][1]).abs}
end

all = (1 << n) - 1
@memo = Array.new(n) {[]}
n.times {|i| @memo[i][all ^ (1 << i)] = [0, [@kuras[i][0]]]}

def try(start, reached = 0, w = 0)
  return @memo[start][reached] if @memo[start][reached]
  n = @kuras.size
  now = @kuras[start]
  min_time = Float::INFINITY
  min_order = nil
  nr = reached | (1 << start)
  w0 = w + now[2]
  n.times do |nxt|
    next if (nr & (1 << nxt)).nonzero?
    time, order = try(nxt, nr, w0)
    time += @edges[start][nxt] * (70 + w0).to_r / 2000
    if time < min_time
      min_time = time
      min_order = [now[0]] + order
    end
  end
  @memo[start][reached] = [min_time, min_order]
end

puts (0...n).map {|i| try(i)}.sort_by(&:first).first.last.join(" ")

