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++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	int num;
	double time;
	int res[8];
	double r[8];
	int i;
	for(i=0;i<8;i++)r[i]=1000000;
	for(i=0;i<8;i++){
		cin>>num>>time;
		if(time<r[0]){
			if(r[1]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[1];
				res[6]=res[1];
			}else if(r[1]<r[7]){
				r[7]=r[1];
				res[7]=res[2];
			}
			r[1]=r[0];
			res[1]=res[0];
			r[0]=time;
			res[0]=num;
		}else if(time<r[1]){
			if(r[1]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[1];
				res[6]=res[1];
			}else if(r[1]<r[7]){
				r[7]=r[1];
				res[7]=res[1];
			}
			r[1]=time;
			res[1]=num;
		}
	}
	for(i=0;i<8;i++){
		cin>>num>>time;
		if(time<r[2]){
			if(r[3]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[3];
				res[6]=res[3];
			}else if(r[3]<r[7]){
				r[7]=r[3];
				res[7]=res[3];
			}
			r[3]=r[2];
			res[3]=res[2];
			r[2]=time;
			res[2]=num;
		}else if(time<r[3]){
			if(r[3]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[3];
				res[6]=res[3];
			}else if(r[3]<r[7]){
				r[7]=r[3];
				res[7]=res[3];
			}
			r[3]=time;
			res[3]=num;
		}
	}
	for(i=0;i<8;i++){
		cin>>num>>time;
		if(time<r[4]){
			if(r[5]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[5];
				res[6]=res[5];
			}else if(r[5]<r[7]){
				r[7]=r[5];
				res[7]=res[5];
			}
			r[5]=r[4];
			res[5]=res[4];
			r[4]=time;
			res[4]=num;
		}else if(time<r[5]){
			if(r[5]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[5];
				res[6]=res[5];
			}else if(r[5]<r[7]){
				r[7]=r[5];
				res[7]=res[4];
			}
			r[5]=time;
			res[5]=num;
		}
	}
	for(i=0;i<8;i++){
		printf("%d %2.2f\n",res[i],r[i]);
	}
	return 0;
}

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

int main(){
    vector<pair<double, int>> p1(8);
    vector<pair<double, int>> p2(8);
    vector<pair<double, int>> p3(8);
    for(int i = 0;i<8;i++){
        cin >> p1[i].second >> p1[i].first;
    }
    for(int i = 0;i<8;i++){
        cin >> p2[i].second >> p2[i].first;
    }
    for(int i = 0;i<8;i++){
        cin >> p3[i].second >> p3[i].first;
    }
    sort(p1.begin(), p1.end());
    sort(p2.begin(), p2.end());
    sort(p3.begin(), p3.end());
    cout << p1[0].second << " " << p1[0].first << endl;
    cout << p1[1].second << " " << p1[1].first << endl;
    cout << p2[0].second << " " << p2[0].first << endl;
    cout << p2[1].second << " " << p2[1].first << endl;
    cout << p3[0].second << " " << p3[0].first << endl;
    cout << p3[1].second << " " << p3[1].first << endl;
    p1.erase(p1.begin(), p1.begin()+2);
    p2.erase(p2.begin(), p2.begin()+2);
    p3.erase(p3.begin(), p3.begin()+2);
    // copy(p2.begin(), p2.end(), back_inserter(p1));
    // copy(p2.begin(), p2.end(), back_inserter(p1));
    p1.insert(p1.end(), p2.begin(), p2.end());
    p1.insert(p1.end(), p3.begin(), p3.end());
    sort(p1.begin(), p1.end());
    cout << p1[0].second << " " << p1[0].first << endl;
    cout << p1[1].second << " " << p1[1].first << endl;
    return 0;
}

C++: #include <iostream>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using namespace std::rel_ops;

#define PAIR pair<double, int>

// /**********オーバーロード**********/
// bool operator>(const PAIR &a, const PAIR &b){
// 	return a.first > b.first;
// }
// bool operator<(const PAIR &a, const PAIR &b){
// 	return a.first < b.first;
// }


int main(){
	priority_queue<PAIR, vector<PAIR>, greater<PAIR> > race, timeq;
	//map<double, int>timeq;

	for(int r = 0; r < 3; r++){
		for(int i = 0; i < 8; i++){
			int player;
			double tim;
			cin >> player >> tim;
			race.push(PAIR(tim, player));
		}

		//グループ上位２位
		for(int i = 0; i < 2; i++){
			cout << race.top().second << " " << race.top().first << endl;
			race.pop();
		}

		//グループ３、４位
		for(int i = 0; i < 2; i++){
			timeq.push(race.top());
			race.pop();
		}
	}

	//Time抜け
	for(int i = 0; i < 2; i++){
		cout << timeq.top().second << " " << timeq.top().first << endl;
		timeq.pop();
	}

}