final = Hash.new
3.times do
        race = Hash.new
        8.times do
                run,time = get.split(" ")
                run = run.to_i
                time = time.to_f
                race << [run,time]
        end
        race.sort!{|t1,t2| t1[1]-t2[1]}
        puts "%d %.2f" % race[0]
        puts "%d %.2f" % race[1]
        final << race[2]
end
final.sort!{|t1,t2| t1[1]-t2[1]}
puts "%d %.2f" % final[0]
puts "%d %.2f" % final[1]