import std.stdio;
import std.string, std.conv;
import std.algorithm, std.array;
import std.typecons;


void main() {
  alias Tuple!(int, "no", real, "time") record;

  record[] rest;

  foreach(i; 0 .. 3) {
    auto t = new record[8];
    foreach(j; 0 .. 8) {
      string[] s = readln().split();
      t[j] = tuple(s[0].to!int(), s[1].to!real());
    }

    t.sort!("a.time < b.time")();

    foreach(it; t[0 .. 2])
      writefln("%d %f", it.no, it.time);

    rest ~= t[2 .. 8];
  }

  sort!("a.time < b.time")(rest);

  foreach(it; rest[0 .. 2])
    writefln("%d %f", it.no, it.time);
}