Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	race1 := make([]player, 8)
	race2 := make([]player, 8)
	race3 := make([]player, 8)
	rest := make([]player, 6)
	for i := 0; i < 8; i++ {
		scanner.Scan()
		input := strings.Split(scanner.Text(), " ")
		no, _ := strconv.Atoi(input[0])
		time, _ := strconv.ParseFloat(input[1], 64)
		race1[i] = player{no, time}
	}
	for i := 0; i < 8; i++ {
		scanner.Scan()
		input := strings.Split(scanner.Text(), " ")
		no, _ := strconv.Atoi(input[0])
		time, _ := strconv.ParseFloat(input[1], 64)
		race2[i] = player{no, time}
	}
	for i := 0; i < 8; i++ {
		scanner.Scan()
		input := strings.Split(scanner.Text(), " ")
		no, _ := strconv.Atoi(input[0])
		time, _ := strconv.ParseFloat(input[1], 64)
		race3[i] = player{no, time}
	}
	for i := 1; i <= 7; i++ {
		for k := 7; k >= i; k-- {
			if race1[k].time < race1[k-1].time {
				race1[k], race1[k-1] = race1[k-1], race1[k]
			}
			if race2[k].time < race2[k-1].time {
				race2[k], race2[k-1] = race2[k-1], race2[k]
			}
			if race3[k].time < race3[k-1].time {
				race3[k], race3[k-1] = race3[k-1], race3[k]
			}
		}
	}
	rest[0] = race1[2]
	rest[1] = race1[3]
	rest[2] = race2[2]
	rest[3] = race2[3]
	rest[4] = race3[2]
	rest[5] = race3[3]
	for i := 1; i <= 5; i++ {
		for k := 5; k >= i; k-- {
			if rest[k].time < rest[k-1].time {
				rest[k],rest[k-1] = rest[k-1], rest[k]
			}
		}
	}
	fmt.Printf("%d %.2f\n", race1[0].no, race1[0].time)
	fmt.Printf("%d %.2f\n", race1[1].no, race1[1].time)
	fmt.Printf("%d %.2f\n", race2[0].no, race2[0].time)
	fmt.Printf("%d %.2f\n", race2[1].no, race2[1].time)
	fmt.Printf("%d %.2f\n", race3[0].no, race3[0].time)
	fmt.Printf("%d %.2f\n", race3[1].no, race3[1].time)
	fmt.Printf("%d %.2f\n", rest[0].no, rest[0].time)
	fmt.Printf("%d %.2f\n", rest[1].no, rest[1].time)
}

type player struct {
	no int
	time float64
}

C++: #pragma warning(disable:4996)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cstdio>

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

int main(){
    vector<pii> v(24);
    rep(i, 24){
        int a, b, c;
        scanf("%d %d.%d",&a,&b,&c);
        v[i] = make_pair(b * 100 + c, a);
    }

    rep(i, 3){
        sort(v.begin() + 8 * i, v.begin() + 8 * i + 8);
    }
    vector<pii> ans;
    rep(i, 3)rep(j, 6){
        ans.push_back(v[i * 8 + j + 2]);
    }
    sort(all(ans));

    rep(i, 3) rep(j, 2){
        double t = 1.*ans[i].first / 100;
        printf("%d %.2f\n", v[i * 8 + j].second, t);
    }
    rep(i, 2){
        double t = 1.*ans[i].first / 100;
        printf("%d %.2f\n", ans[i].second, t);
    }
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

typedef pair<double, int> data;

int main() {
    vector<data> a, b, c;
    vector<data> all;
    for (int i = 0; i < 8; i++) {int n; double time; cin >> n >> time; a.push_back(make_pair(time, n));}
    for (int i = 0; i < 8; i++) {int n; double time; cin >> n >> time; b.push_back(make_pair(time, n));}
    for (int i = 0; i < 8; i++) {int n; double time; cin >> n >> time; c.push_back(make_pair(time, n));}
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    all.insert(all.end(), a.begin()+2, a.end());
    all.insert(all.end(), b.begin()+2, b.end());
    all.insert(all.end(), c.begin()+2, c.end());
    sort(all.begin(), all.end());
    cout.setf(ios::showpoint);
    cout.precision(4);
    cout << a[0].second << ' ' << a[0].first << endl;
    cout << a[1].second << ' ' << a[1].first << endl;
    cout << b[0].second << ' ' << b[0].first << endl;
    cout << b[1].second << ' ' << b[1].first << endl;
    cout << c[0].second << ' ' << c[0].first << endl;
    cout << c[1].second << ' ' << c[1].first << endl;
    cout << all[0].second << ' ' << all[0].first << endl;
    cout << all[1].second << ' ' << all[1].first << endl;
    return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
main(){
  int n,i,a[8];
  double t,k[8]={1000,1000,1000,1000,1000,1000,1000,1000};
  for(i=0;i<24;i++){
    cin >> n >> t;
    if(n<9){
      if(t<k[0]){
	if(k[1]<k[6]){
	  a[7]=a[6];
	  a[6]=a[1];
	  k[7]=k[6];
	  k[6]=k[1];
	}
	else if(k[1]<k[7]){
	  a[7]=a[1];
	  k[7]=k[1];
	}
	a[1]=a[0];
	a[0]=n;
	k[1]=k[0];
	k[0]=t;
      }
      else if(t<k[1]){
	if(a[1]<a[6]){
	  a[7]=a[6];
	  a[6]=a[1];
	  k[7]=k[6];
	  k[6]=k[1];
	}
	else if(k[1]<k[7]){
	  a[7]=a[1];
	  k[7]=k[1];
	}
	a[1]=n;
	k[1]=t;
      }
    }
    else if(n<17){
      if(t<k[2]){
	if(k[3]<k[6]){
	  a[7]=a[6];
	  a[6]=a[3];
	  k[7]=k[6];
	  k[6]=k[3];
	}
	else if(k[3]<k[7]){
	  a[7]=a[3];
	  k[7]=k[3];
	}
	a[3]=a[2];
	a[2]=n;
	k[3]=k[2];
	k[2]=t;
      }
      else if(t<k[3]){
	if(k[3]<k[6]){
	  a[7]=a[6];
	  a[6]=a[3];
	  k[7]=k[6];
	  k[6]=k[3];
	}
	else if(k[3]<k[7]){
	  a[7]=a[3];
	  k[7]=k[3];
	}
	a[3]=n;
	k[3]=t;
      }
    }
    else{
      if(t<k[4]){
	if(k[5]<k[6]){
	  a[7]=a[6];
	  a[6]=a[5];
	  k[7]=k[6];
	  k[6]=k[5];
	}
	else if(k[5]<k[7]){
	  a[7]=a[5];
	  k[7]=k[5];
	}
	a[5]=a[4];
	a[4]=n;
	k[5]=k[4];
	k[4]=t;
      }
      else if(t<k[5]){
	if(k[1]<k[6]){
	  a[7]=a[6];
	  a[6]=a[5];
	  k[7]=k[6];
	  k[6]=k[5];
	}
	else if(k[5]<k[7]){
	  a[7]=a[5];
	  k[7]=k[5];
	}
	a[5]=n;
	k[5]=t;
      }
    }
  }
  for(i=0;i<8;i++){
    printf("%d %.2lf\n",a[i],k[i]);
  }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;

#define MAX_N 8000
#define MAX_M 23994

pair<double, int>a[MAX_N]; 
pair<double, int>b[MAX_N]; 
pair<double, int>c[MAX_N];
pair<double, int>d[MAX_M];

void _cin(int p) {
	for (int i = 0; i < p; i++) {
		cin >> a[i].second >> a[i].first;
	}
	for (int i = 0; i < p; i++) {
		cin >> b[i].second >> b[i].first;
	}
	for (int i = 0; i < p; i++) {
		cin >> b[i].second >> b[i].first;
	}
}

void sort1(int p) {
	sort(a, a + p);
	sort(b, b + p);
	sort(c, c + p);
	for (int i = 0; i < 6; i++) {
		d[i].first = a[i + 2].first;
		d[i].second = a[i + 2].second;
	}
	for (int i = 0; i < 6; i++) {
		d[i + p - 2].first = b[i + 2].first;
		d[i + p - 2].second = b[i + 2].second;
	}
	for (int i = 0; i < 6; i++) {
		d[i + p + p - 4].first = c[i + 2].first;
		d[i + p + p - 4].second = c[i + 2].second;
	}
	sort(d, d + p * 3 - 6);
}

void print() {
	cout << a[0].second << ' ' << a[0].first << endl;
	cout << a[1].second << ' ' << a[1].first << endl;
	cout << b[0].second << ' ' << b[0].first << endl;
	cout << b[1].second << ' ' << b[1].first << endl;
	cout << c[0].second << ' ' << c[0].first << endl;
	cout << c[1].second << ' ' << c[1].first << endl;
	cout << d[0].second << ' ' << d[0].first << endl;
	cout << d[1].second << ' ' << d[1].first << endl;
}

int main() {
	_cin(8);
	sort1(8);
	print();
	return 0;
}