import scala.io.StdIn.readLine

object Main {
  def getTop3() = {
    {
      for(i<-1 to 7) yield {
        val n = readLine.split(" ")
        (n(0).toInt, n(1).toDouble)
      }
    }.toList.sortBy(_._2).take(3)
  }

  def main(args:Array[String]) = {
    val x1 = getTop3
    val x2 = getTop3
    val x3 = getTop3
    val r = List(x1(0),x1(1),x2(0),x2(1),x3(0),x3(1)) ++ List(x1(2),x2(2),x3(2)).sortBy(_._2).take(2)
    println(r.map(e =>e._1+" "+e._2).mkString("\n"))
  }
}