a = $<.map{|l| i, t = l.split.map(&:to_f); [i.to_i, t] }
rest = []
a.each_slice(8){|g|
    g.sort_by!(&:last)
    g[0..1].each{|x| printf("%d %.2f\n", *x)}
    rest += g[2..7]
}
rest.sort_by!(&:last)
rest[0..1].each{|x| printf("%d %.2f\n", *x)}