class Runner
  include Comparable
  attr_reader :time, :to_s
  def initialize(num, time)
    @num = num.to_i
    @time = time.to_f
    @to_s = num.to_s + " " + time
  end
  def <=>(other)
    return @time <=> other.time
  end
end
arr1 = Array.new(8){Runner.new(*gets.split(" "))}.sort
arr2 = Array.new(8){Runner.new(*gets.split(" "))}.sort
arr3 = Array.new(8){Runner.new(*gets.split(" "))}.sort
puts arr1[0,2], arr2[0,2], arr3[0,2], (arr1[2..-1] + arr2[2..-1] + arr3[2..-1]).sort[0, 2].map(&:to_s)