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 <iostream>
#include <utility>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

typedef pair<string, int> P;

int main()
{
	P run[4][8];
	vector<P> sub;
	
	for (int i = 0; i < 3; i++){
		for (int j = 0; j < 8; j++){
			cin >> run[i][j].second >> run[i][j].first;
		}
		sort(run[i], run[i] + 8);
		
		for (int j = 2; j < 8; j++){
			sub.push_back(run[i][j]);
		}
	}
	sort(sub.begin(), sub.end());
	run[3][0] = sub[0];
	run[3][1] = sub[1];
	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 2; j++){
			cout << run[i][j].second << " " << run[i][j].first << endl;
		}
	}
	
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;


//??????
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int p = 1; p < N; p++) cout << ", " << v[p]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()

// time, num
typedef pair<int, int> pii;

int main()
{
	vector<pii> g[3], gg;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 8; j++) {
			int no, sec, msec;
			scanf("%d %d.%2d", &no, &sec, &msec);

			g[i].push_back(pii(sec * 100 + msec, no));
		}
		sort(all(g[i]));
	}

	for (int i = 0; i < 3; i++) {
		for (int j = 2; j < 8; j++) {
			gg.push_back(g[i][j]);
		}
	}
	sort(all(gg));

	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 2; j++) {
			pii& p = g[i][j];
			printf("%d %d.%02d\n", p.second, p.first / 100, p.first % 100);
		}
	}

	for (int i = 0; i < 2; i++) {
		pii& p = gg[i];
		printf("%d %d.%02d\n", p.second, p.first / 100, p.first % 100);
	}

	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(){
	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 <algorithm>
#include <iomanip>
using namespace std;
#define P pair<int,double>
bool cmp(P a, P b){
	return a.second < b.second;
}

int main() {
	P Group[3][8];
	for(int i=0;i<3;i++) for(int j=0;j<8;j++){
		int tmp; double TMP; cin >> tmp >> TMP;
		Group[i][j]= P (tmp,TMP);
	}
	for(int i=0;i<3;i++) sort(Group[i],Group[i]+8,cmp);
	P ans[8];
	for(int j=0;j<3;j++) for(int i=0;i<2;i++) ans[2*j+i]=Group[j][i];
	P GroupNew[24];
	for(int i=0;i<3;i++) for(int j=2;j<8;j++){
		GroupNew[6*i+(j-2)]=Group[i][j];
	}
	sort(GroupNew,GroupNew+18,cmp);
	for(int j=0;j<2;j++) ans[6+j]=GroupNew[j];
	cout << fixed << setprecision(2);
	for(int i=0;i<8;i++) cout << ans[i].first << ' ' << ans[i].second << '\n' ;
}

C++: #include <cstdio>
#include <algorithm>
#include <utility>
#include <iostream>
#include <vector>
using namespace std;
typedef pair<double,int> P;
#define fi first
#define sec second
#define pb push_back
vector<P> v[3];
int main()
{
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<8;j++)
		{
			P a;
			cin >> a.sec >> a.fi;
			v[i].pb(a);
		}
		sort(v[i].begin(),v[i].end());
	}
	for(int i=0;i<3;i++)
	{
		printf("%d %.2f\n",v[i][0].sec,v[i][0].fi);
		printf("%d %.2f\n",v[i][1].sec,v[i][1].fi);
	}
	vector<P> rem;
	for(int i=0;i<3;i++)
	{
		for(int j=2;j<8;j++)
		{
			rem.pb(v[i][j]);
		}
	}
	sort(rem.begin(),rem.end());
	printf("%d %.2f\n",rem[0].sec,rem[0].fi);
	printf("%d %.2f\n",rem[1].sec,rem[1].fi);
	return 0;
}