times = [[], [], []]
losers = []
3.times{|i|
    8.times{|j|
        line = gets.chomp.split
        times[i] << line
        losers << line
    }
    times[i].sort_by!{|item| (item[1].to_f)}
    puts times[i][0].join(" ")
    puts times[i][1].join(" ")
    losers.delete times[i][0]
    losers.delete times[i][1]
}

losers.sort_by!{|item| (item[1].to_f)}
puts losers[0].join(" ")
puts losers[1].join(" ")