n = gets.to_i
kura = (1..n).map{gets.split.map &:to_i}

route = {}
(0..n-1).each {|i| route[[1 << i, i]] = [i] }

cost = Array.new(2**n).map{[Float::INFINITY] * n}
(0..n-1).each {|i| cost[1 << i][i] = 0 }

weight = Array.new(2 ** n, 0)
(0..n-1).each {|i| weight[1 << i] = kura[i][2] * 20}

(1..2**n-1).each do |x|
	ones = (0..n-1).select{|i| x[i] == 1}
	zeros = (0..n-1).to_a - ones
	v = 2000.0 / (70 + weight[x])
	ones.each do |i|
		key1 = [x, i]
		c0 = cost[x][i]
		d0 = kura[i][1]
		w = weight[x]
		zeros.each do |j|
			y = x | (1 << j)
			weight[y] = w + kura[j][2] * 20
			c = c0 + (kura[j][1] - d0).abs / v
			key2 = [y, j]
			if c < cost[y][j]
				cost[y][j] = c 
				route[key2] = route[key1] + [j]
			end
		end
	end
end

puts route[[2**n-1, (0..n-1).min_by{|i| cost[2**n-1][i]}]].map{|i| kura[i][0]} * ' '