### constant

MAX_TIME = 1.0e20

### global variables

$min_time = MAX_TIME
$min_ids = []
$edges = []

$pathhash = {}

### subroutines

def check_path(src, strs)
  #p "check_path(#{src}, #{strs})"

  n = strs.length
  return [0.0, 0.0, [strs[src][0]]] if n == 1

  key = "#{src}-" + strs.map{|st| st[0]}.join(',')
  return $pathhash[key] if ! $pathhash[key].nil?

  stsrc = strs.delete_at(src)
  n -= 1

  min_time = MAX_TIME
  min_dist = 0.0
  min_ids = []

  for nxt in (0...n)
    #p "(#{stsrc[0]})src=#{src}, stsrc[3]=#{stsrc[3]}"
    #p "(#{strs[nxt][0]})nxt=#{nxt}, strs[nxt][3]=#{strs[nxt][3]}"

    ntime, ndist, nids = check_path(nxt, strs)
    dist = $edges[stsrc[3]][strs[nxt][3]] + ndist
    time = ntime + dist * (70 + 20 * stsrc[2]) / 2000

    if min_time > time
      min_time = time
      min_dist = dist
      min_ids = [stsrc[0]] + nids
    end
  end
  strs[src, 0] = [stsrc]

  $pathhash[key] = [min_time, min_dist, min_ids]
end

### main

n = gets.strip.to_i
strs = (0...n).map{|i| gets.strip.split(' ').map{|s| s.to_i} + [i]}

$edges = (0...n).map{(0...n).map{nil}}
for i in (0...n)
  for j in ((i + 1)...n)
    $edges[i][j] = $edges[j][i] = (strs[i][1] - strs[j][1]).abs.to_f
  end
end

min_time = MAX_TIME
min_ids = []

for src in (0...n)
  time, dist, ids = check_path(src, strs)
  if min_time > time
    min_time = time
    min_ids = ids
  end
end

puts min_ids.join(' ')