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 res[8];
double r[8];

void f(double t,int n){
	if(t<r[6]){
		r[7]=r[6];
		res[7]=res[6];
		r[6]=t;
		res[6]=n;
	}else if(t<r[7]){
		r[7]=t;
		res[7]=n;
	}
}

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

C++: #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    vector<pair<double, int>> amari;
    for (int i = 0; i < 3; ++i) {
        vector<pair<double, int>> v;
        for (int j = 0; j < 8; ++j) {
            int x; double k;
            cin >> x >> k;
            v.emplace_back(k, x);
        }
        sort(v.begin(),v.end());
        for (int j = 0; j < 8; ++j) {
            if(j < 2){
                printf("%d %.2lf\n", v[j].second, v[j].first);
            }else {
                amari.emplace_back(v[j]);
            }
        }
    }
    sort(amari.begin(),amari.end());
    for (int j = 0; j < 2; ++j) {
        if(j < 2){
            printf("%d %.2lf\n", amari[j].second, amari[j].first);
        }
    }
    return 0;
}

C++: #include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	map<double, int> n_t;
	int race = 3;
	int num;
	double t;
	vector<double> rank, all;
	while( race-- > 0 ){
		for( int i = 0; i < 8; i++ ){
			cin >> num >> t;
			n_t[t] = num;
			rank.push_back(t);
		}
		sort(rank.begin(), rank.end());
		vector<double>::iterator it = rank.begin();
		cout << n_t[*it] << ' ' << *it << endl;
		//rank.erace(it);
		it++;
		cout << n_t[*it] << ' ' << *it << endl;
		it++;
		for( ; it != rank.end(); it++ ){
			all.push_back(*it);
		}
		rank.clear();
	}
	sort(all.begin(), all.end());
	vector<double>::iterator it = all.begin();
	cout << n_t[*it] << ' ' << *it << endl;
	it++;
	cout << n_t[*it] << ' ' << *it << endl;

	return 0;
}

C++: #include <iostream>
#include <iomanip>
using namespace std;
int main(){
	int p[25];
	float t[25];
	bool x[25]={0};
	for(int i=1;i<25;i++){
		cin>>p[i]>>t[i];
	}
	for(int i=0;i<=16;i=i+8){
		float max=100.0,max2=100.0;
		int cnt=0,cnt2=0;
		for(int j=1;j<=8;j++){
			if(max2>t[j+i]){
				if(max>t[i+j]){
					max2=max;
					max=t[i+j];
					cnt2=cnt;
					cnt=i+j;
				}else{
					max2=t[i+j];
					cnt2=i+j;
				}
			}
		}
		x[cnt]=1,x[cnt2]=1;
		cout<<cnt<<" "<<setprecision( 4 )<<max<<endl<<cnt2<<" "<<setprecision( 4 )<<max2<<endl;
	}
	float y=100.0,z=100.0;
	int cnt3=0,cnt4=0;
	for(int i=1;i<=24;i++){
		if(x[i]==0){
			if(z>t[i]){
				if(y>t[i]){
					z=y;
					y=t[i];
					cnt4=cnt3;
					cnt3=i;
				}else{
					z=t[i];
					cnt4=i;
				}
			}
		}
	}
	cout<<setprecision(4)<<cnt3;cout<<" "<<y<<endl;
	cout<<setprecision(4)<<cnt4;cout<<" "<<z<<endl;
	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

typedef pair<double, int> pdi;

int main(){

	pdi v[3][8];
	
	for(int i=0; i<24; ++i){
		
		double a;
		int b;
		
		scanf("%d %lf", &b, &a);
		v[i/8][i%8] = make_pair(a, b);
	}
	
	for(int i=0; i<3; ++i){
		sort(v[i], v[i]+8);
	}
	
	vector<pdi> rest;
	
	for(int i=0; i<24; ++i){
	
		if(i%8<2)
			printf("%d %.2f\n", v[i/8][i%8].second, v[i/8][i%8].first);
		else
			rest.push_back(v[i/8][i%8]);
	}
	
	sort(rest.begin(), rest.end());
	
	for(int i=0; i<2; ++i){
		printf("%d %.2f\n", rest[i].second, rest[i].first);
	}
	
	return 0;
}