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 <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<double,int> p;

int main(){
    vector<p> v,th;
    int n = 3,num;
    double data;
    
    while(n--){
        v.clear();
        for(int i = 0 ; i < 8 ; i++){
            cin >> num >> data;
            v.push_back(p(data,num));
        }
        sort(v.begin(),v.end());
        printf("%d %.2f\n" ,v[0].second,v[0].first);
        printf("%d %.2f\n" ,v[1].second,v[1].first);
        th.push_back(v[2]);
    }
    sort(th.begin(),th.end());
    printf("%d %.2f\n" ,th[0].second,th[0].first);
    printf("%d %.2f\n" ,th[1].second,th[1].first);
    return 0;
}

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

using namespace std;

//pairを2つ操作。トラック辺り３位以下を保存しておく。

int main()
{
    pair<double,int> p1[8], p2[18];
    int repeat = 0;
    for( int i = 0; i < 8; i++ )
    {
        scanf( "%d %lf\n", &p1[i].second, &p1[i].first );
    }
    sort( p1, p1 + 8 );
    for( int i = 2; i < 8; i++ )
    {
        p2[i - 2].first = p1[i].first;
        p2[i - 2].second = p1[i].second;
    }
    printf( "%d %.2lf\n%d %.2lf\n", p1[0].second, p1[0].first, p1[1].second, p1[1].first );
    for( int i = 0; i < 8; i++ )
    {
        scanf( "%d %lf\n", &p1[i].second, &p1[i].first );
    }
    sort( p1, p1 + 8 );
    for( int i = 6; i < 12; i++ )
    {
        p2[i].first = p1[i - 4].first;
        p2[i].second = p1[i - 4].second;
    }
    printf( "%d %.2lf\n%d %.2lf\n", p1[0].second, p1[0].first, p1[1].second, p1[1].first );
    for( int i = 0; i < 8; i++ )
    {
        scanf( "%d %lf\n", &p1[i].second, &p1[i].first );
    }
    sort( p1, p1 + 8 );
    for( int i = 12; i < 18; i++ )
    {
        p2[i].first = p1[i- 10].first;
        p2[i].second = p1[i - 10].second;
    }
    printf( "%d %.2lf\n%d %.2lf\n", p1[0].second, p1[0].first, p1[1].second, p1[1].first );
    sort( p2, p2 + 18 );
    printf( "%d %.2lf\n%d %.2lf\n", p2[0].second, p2[0].first, p2[1].second, p2[1].first );
    return 0;
}

C++: #include <stdio.h>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

struct smap {
    int number;
    double time;
};typedef struct smap Smap;

//プロトタイプ宣言
bool tfsort (const Smap &a, const Smap &b);

//main関数
int main(){
    int i, idx = 0;
    Smap rec[50];
    
    //入力
    for(i = 0;i < 24; i++){
        scanf("%d %lf", &rec[i].number, &rec[i].time);
    }
    
    
    
    //3組ごとのソート
    for(i = 0; i < 17; i += 8){
        sort(rec + i, rec + i + 8, tfsort);
    }
    //上位二組出力
    for(i = 0; i < 3; i++){
        printf("%d %0.2f\n", rec[idx].number, rec[idx].time);
        printf("%d %0.2f\n", rec[idx + 1].number, rec[idx + 1].time);
        rec[idx].time = -1.0;
        rec[idx + 1].time = -1.0;
        idx += 8;
    }
    
    //全てのチームをソート
    sort(rec, rec + 24, tfsort);
    
    //3位以下の上位二人を出力
    for(i = 6; i < 8; i++){
        printf("%d %0.2f\n", rec[i].number, rec[i].time);
    }
    
    return 0;
}

bool tfsort (const Smap &a, const Smap &b){
    if(a.time < b.time) return true;
    return false;
}