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
}

Python: dataset = [[input().split() for _ in range(8)] for _ in range(3)]
tmp = []
for i in range(3):
    s = sorted(dataset[i], key=lambda x: x[1])[:3]
    tmp.append(s[-1])
    for p in s[:2]:
        print(*p)
a, b = sorted(tmp, key=lambda x: x[1])[:2]
print(*a, "\n", *b)

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

struct record{
	int num;
	double time;
};

bool operator<(const record& a, const record& b){
	return a.time < b.time;
}

int main(void){
	vector<record> rec1;
	vector<record> rec2;
	vector<record> rec3;
	vector<record> allrec;
	int i;
	record allbuf;
	
	for(i = 0; i < 8; i++){
		record buf;
		cin >>buf.num >>buf.time;
		rec1.push_back(buf);
	}
	sort(rec1.begin(), rec1.end());
	
	for(i = 0; i < 8; i++){
		record buf;
		cin >>buf.num >>buf.time;
		rec2.push_back(buf);
	}
	sort(rec2.begin(), rec2.end());
	
	for(i = 0; i < 8; i++){
		record buf;
		cin >>buf.num >>buf.time;
		rec3.push_back(buf);
	}
	sort(rec3.begin(), rec3.end());
	
	printf("\n%d %.2f\n", rec1[0].num, rec1[0].time);
	printf("%d %.2f\n", rec1[1].num, rec1[1].time);
	printf("%d %.2f\n", rec2[0].num, rec2[0].time);
	printf("%d %.2f\n", rec2[1].num, rec2[1].time);
	printf("%d %.2f\n", rec3[0].num, rec3[0].time);
	printf("%d %.2f\n", rec3[1].num, rec3[1].time);
	
	for(i = 2; i < 8; i++){
		allbuf = rec1[i];
		allrec.push_back(allbuf);
	}
	for(i = 2; i < 8; i++){
		allbuf = rec2[i];
		allrec.push_back(allbuf);
	}
	for(i = 2; i < 8; i++){
		allbuf = rec3[i];
		allrec.push_back(allbuf);
	}
	sort(allrec.begin(), allrec.end());
	
	printf("%d %.2f\n", allrec[0].num, allrec[0].time);
	printf("%d %.2f\n", allrec[1].num, allrec[1].time);
	
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef long long ll;
typedef unsigned long long ull;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); i++ )
#define UREP( i, m, n ) for ( unsigned int i = (unsigned int)( m ); i < (unsigned int)( n ); i++ )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define RALL( c ) (c).rbegin(), (c).rend()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

int main()
{
	vector< vector< pair<double,int> > > runners( 3 );

	REP( i, 0, 3 )
	{
		runners[i].resize( 8 );

		REP( j, 0, 8 )
		{
			cin >> runners[i][j].snd >> runners[i][j].fst;
		}
	}

	vector< pair<double,int> > passed;
	vector< pair<double,int> > nokori;

	REP( i, 0, 3 )
	{
		sort( ALL( runners[i] ) );

		REP( j, 0, 8 )
		{
			if ( j < 2 )
			{
				passed.PB( runners[i][j] );
			}
			else
			{
				nokori.PB( runners[i][j] );
			}
		}
	}

	sort( ALL( nokori ) );
	passed.PB( nokori[0] );
	passed.PB( nokori[1] );

	cout.precision( 2 );

	REP( i, 0, 8 )
	{
		cout << passed[i].snd << ' ' << setiosflags( ios::fixed ) << passed[i].fst << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;
void sort(double input[][2],int k){
    if(input[k][1] > input[k+1][1]){
        double num[2];
        num[0] = input[k][0];
        num[1] = input[k][1];
        input[k][0] = input[k+1][0];
        input[k][1] = input[k+1][1];
        input[k+1][0] = num[0];
        input[k+1][1] = num[1];
    }
}
int main(){
    double input[24][2];
    double ans[9][2];
    int a,b;
    a = b = 0;
    rep(i,24){
        cin >> input[i][0] >> input[i][1];
    }
    rep(i,3){
        range(j,i*8,i*8+7){
            range(k,i*8,i*8+7){
                sort(input, k);
            }
        }
    }
    rep(i,3){
        range(j,i*8,i*8+2){
            ans[a][0] = input[j][0];
            ans[a++][1] = input[j][1];
        }
        ans[6+i][0] = input[2+i*8][0];
        ans[6+i][1] = input[2+i*8][1];
    }
    range(i,6,8){
        range(j,6,8){
            sort(ans,j);
        }
    }
    rep(i,8){
        printf("%d ",(int)ans[i][0]);
        cout << setprecision(4) << showpoint << ans[i][1] << endl;
    }
}

C++: #include <cstdio>
#include <queue>
using namespace std;

typedef pair<double, int> PAIR;

int main(){
	int c;
	double v;
	priority_queue<PAIR> queu;
	for(int i = 0; i < 3; i++){
		priority_queue<PAIR> que;
		for(int j = 0; j < 8; j++){
			scanf("%d %lf", &c, &v);
			que.push(PAIR(-v, c));
		}
		c = que.top().second;
		v = que.top().first;
		printf("%d %lf\n", c, -v);
		que.pop();
		c = que.top().second;
		v = que.top().first;
		printf("%d %lf\n", c, -v);
		que.pop();
		for(int j = 0; j < 18; j++){
			queu.push(PAIR(que.top().first, que.top().second));
			que.pop();
		}
	}
	c = queu.top().second;
	v = queu.top().first;
	printf("%d %lf\n", c, -v);
	queu.pop();
	c = queu.top().second;
	v = queu.top().first;
	printf("%d %lf\n", c, -v);
	queu.pop();
	return 0;
}