ptss = 3.times.map do
  pts = 8.times.map do
    p, t = gets.split
    [p.to_i, t.to_f]
  end
  pts.sort_by { |(p, t)| t }
end

ptss.each do |pts|
  p1, p2 = pts.shift 2
  printf "%d %.2f\n", p1[0], p1[1]
  printf "%d %.2f\n", p2[0], p2[1]
end

p1, p2 = [*ptss[0], *ptss[1], *ptss[2]].sort_by { |(p, t)| t }.shift 2
printf "%d %.2f\n", p1[0], p1[1]
printf "%d %.2f\n", p2[0], p2[1]
