allmember = Hash.new
3.times do
    member = Hash.new
    fast_time1 = 10000
    fast_time2 = 100000
    8.times do
        x = gets
        y = x.split(" ")
        id = y[0].to_i
        time = y[1].to_f
        if time < fast_time1
            fast_time2 = fast_time1
            fast_time1 = time
        elsif time < fast_time2
            fast_time2 = time
        end
        member.store(id,time)
        allmember.store(id,time)
    end
    winner1 = member.find{|k,v| v == fast_time1}
    winner2 = member.find{|k,v| v == fast_time2}
    puts "#{winner1[0]} #{winner1[1]}"
    puts "#{winner2[0]} #{winner2[1]}"

    allmember.delete(winner1[0])
    allmember.delete(winner2[0])
    
end

ds = allmember.min{ |x, y| x[1] <=> y[1] }
puts "#{ds[0]} #{ds[1]}"
allmember.delete(ds[0])

za =  allmember.min{ |x, y| x[1] <=> y[1] }
puts "#{za[0]} #{za[1]}"


