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<stdio.h>
#include<utility>
#include<algorithm>
#include<limits>
using namespace std;
int main()
{
	const int N1 = 3, N2=8;
	int i,j;
	pair<double,int>a[N2], w1,w2;
	w1.first = w2.first = numeric_limits<double>::max();
	for(i=0;i<N1;++i)
	{
		for(j=0;j<N2;++j)
		{
			scanf("%d %lf",&a[j].second, &a[j].first);
		}
		sort(a, a+N2);
		for(j=0;j<2;++j)
			printf("%d %.2f\n",a[j].second, a[j].first);
		for(j=2;j<4;++j)
		{
			if(w1.first > a[j].first)
			{
				w2=w1;
				w1=a[j];
			}
			if(w2.first > a[j].first)
				w2 = a[j];
		}	
	}
	printf("%d %.2f\n"
		"%d %.2f\n", w1.second, w1.first, w2.second, w2.first);
	return 0;
}

C++: #include<stdio.h>   
#include<iostream>
using namespace std;

struct ply{int cl;int nu;int m;int s;int A;};

int main()
{

ply NUM[4][9],M1,M2,M3,T;
for(int ii=0;ii<3;ii++)
{
	
	for(int i=0;i<8;i++)
	{
		NUM[ii][i].cl=ii;
		scanf("%d %d.%d",&NUM[ii][i].nu,&NUM[ii][i].m,&NUM[ii][i].s);
		NUM[ii][i].A=100*NUM[ii][i].m+NUM[ii][i].s;
	}
	for(int i=0;i<8;i++){
		for(int j=8;j>i;j--){
			if(NUM[ii][i].A>NUM[ii][j].A)swap(NUM[ii][i],NUM[ii][j]);
		}
	}
}
M1=NUM[0][2];M2=NUM[1][2];M3=NUM[2][2];
if(M1.A<M2.A)swap(M1,M2);
if(M1.A<M3.A)swap(M1,M3);
if(M2.A<M3.A)swap(M2,M3);
for(int i=0;i<2;i++){
		for(int j=0;j<1;j++){
			if(NUM[i][j].s/10>0)cout<<NUM[i][j].nu<<" "<<NUM[i][j].m<<"."<<NUM[i][j].s<<endl;
			else if(NUM[i][j].s/10==0)cout<<NUM[i][j].nu<<" "<<NUM[i][j].m<<"."<<"0"<<NUM[i][j].s<<endl;
		}
}
if(M3.s/10>0)cout<<M3.nu<<" "<<M3.m<<"."<<M3.s<<endl;
else if(M3.s/10==0)cout<<M3.nu<<" "<<M3.m<<"."<<"0"<<M3.s<<endl;

if(M2.s/10>0)cout<<M2.nu<<" "<<M2.m<<"."<<M2.s<<endl;
else if(M2.s/10==0)cout<<M2.nu<<" "<<M2.m<<"."<<"0"<<M2.s<<endl;

return 0;
}

C++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

void Output(vector<pair<int, double> > ans){
	for (int i = 0; i < ans.size(); i++){
		printf("%d %.2lf\n", ans[i].first, ans[i].second);
	}
}

int main(){
	// 注意：it = hogehoge.erase(it) 使用時はC++11でコンパイル.

	int number = 0, count = 0;
	double time = 0.0;
	map<double, int>	time_number;
	vector<pair<int, double> > ans;
	map<double, int>	plus2;

	while (cin >> number >> time){
		count++;
		time_number.insert(pair<double, int>(time, number));

		if (count == 8){
			map<double, int>::iterator it = time_number.begin();
			// 上位2人をansに格納
			for (int i = 0; i < 2; i++){
				ans.push_back(make_pair((*it).second, (*it).first));
				it = time_number.erase(it);
			}
			// それ以外はplus2に格納
			for (map<double, int>::iterator it = time_number.begin(); it != time_number.end(); it++){
				double first = (*it).first;
				int second = (*it).second;
				plus2.insert(pair<double, int>(first, second));
			}
			count = 0;
			time_number.clear();
		}
	}
	// ここまでで6人決まった

	// plus2の上位2人をansに格納
	map<double, int>::iterator it = plus2.begin();
	for (int i = 0; i < 2; i++){
		ans.push_back(make_pair((*it).second, (*it).first));
		it = plus2.erase(it);
	}

	Output(ans);
	return 0;
}

C++: #include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<utility>
#include<cctype>
using namespace std;

#define ull unsigned long long
#define ll long long
#define stt(it,order) sort(it.begin(),it.end(),order)
#define st(it) sort(it.begin(),it.end())
#define rep(i,j) for(int i=0;i<j;++i)
#define loop(i,a,j) for(int i=a;i<j;++i)
#define mpi(it,table,T,E) for(map<T,E>::iterator it = table.begin();it!=table.end();++it)
#define PI 3.141592654
/*
ifstream fin("input.txt");
ofstream fout("output.txt");
#define cin fin
#define cout fout
*/

struct data{
	int i;
	double t;
};

bool order(data a,data b){
	return a.t < b.t;
}

int main(){
	data tmp;
	vector<data> g_1;
	vector<data> g_2;
	vector<data> g_3;

	rep(i,24){
		scanf("%d %lf",&tmp.i,&tmp.t);
		if( 1 <= tmp.i && tmp.i <=8){
			g_1.push_back(tmp);
		}else if( 9 <= tmp.i && tmp.i <=16){
			g_2.push_back(tmp);
		}else if( 17 <= tmp.i && tmp.i <= 24){
			g_3.push_back(tmp);
		}
	}
	stt(g_1,order);
	stt(g_2,order);
	stt(g_3,order);
	printf("%d %.2lf\n",g_1[0].i,g_1[0].t);
	printf("%d %.2lf\n",g_1[1].i,g_1[1].t);
	printf("%d %.2lf\n",g_2[0].i,g_2[0].t);
	printf("%d %.2lf\n",g_2[1].i,g_2[1].t);
	printf("%d %.2lf\n",g_3[0].i,g_3[0].t);
	printf("%d %.2lf\n",g_3[1].i,g_3[1].t);
	vector<data> g_e;
	g_e.push_back(g_1[2]);
	g_e.push_back(g_2[2]);
	g_e.push_back(g_3[2]);
	stt(g_e,order);
	printf("%d %.2lf\n",g_e[0].i,g_e[0].t);
	printf("%d %.2lf\n",g_e[1].i,g_e[1].t);
	return 0;
}