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<iomanip>
#include<cstdlib>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	vector<pair<string, pair<ll, string> > > hoge;
	vector<pair<string, pair<ll, string> > > a(8);
	vector<pair<string, pair<ll, string> > > b(8);
	vector<pair<string, pair<ll, string> > > c(8);
	REP(i, 8) {
		int p;
		string t;
		cin>>p>>t;
		string tn;
		a[i].second.first = p;
		a[i].second.second = t;
		REP(i, t.size()) {
			if(t[i] == '.') {
				t.erase(t.begin() + i);
			}
		}
		tn = t;
		a[i].first = tn;
	}
	sort(ALL(a));
	cout<<a[0].second.first<<" "<<a[0].second.second<<endl;
	cout<<a[1].second.first<<" "<<a[1].second.second<<endl;
	REP(i, 8) {
		int p;
		string t;
		cin>>p>>t;
		string tn;
		b[i].second.first = p;
		b[i].second.second = t;
		REP(i, t.size()) {
			if(t[i] == '.') {
				t.erase(t.begin() + i);
			}
		}
		tn = t;
		b[i].first = tn;
	}
	sort(ALL(b));
	cout<<b[0].second.first<<" "<<b[0].second.second<<endl;
	cout<<b[1].second.first<<" "<<b[1].second.second<<endl;
	REP(i, 8) {
		int p;
		string t;
		cin>>p>>t;
		string tn;
		c[i].second.first = p;
		c[i].second.second = t;
		REP(i, t.size()) {
			if(t[i] == '.') {
				t.erase(t.begin() + i);
			}
		}
		tn = t;
		c[i].first = tn;
	}
	sort(ALL(c));
	cout<<c[0].second.first<<" "<<c[0].second.second<<endl;
	cout<<c[1].second.first<<" "<<c[1].second.second<<endl;
	REP(i, 6) {
		hoge.pb(a[2 + i]);
	}
	REP(i, 6) {
		hoge.pb(b[2 + i]);
	}
	REP(i, 6) {
		hoge.pb(c[2 + i]);
	}
	sort(ALL(hoge));
	cout<<hoge[0].second.first<<" "<<hoge[0].second.second<<endl;
	cout<<hoge[1].second.first<<" "<<hoge[1].second.second<<endl;
}

C++: #include <iostream>
#include <map>

using namespace std;

int main(){
	int number;
	float times;
	map<float, int> race1, race2, race3,top;

	for(int i = 0; i<24; i++){
		cin >> number >> times;
		if(i<8){
			race1.insert(make_pair(times, number));
		} 
		else if(i<16){
			race2.insert(make_pair(times, number));
		} else {
			race3.insert(make_pair(times, number));
		}
	}

	int cnt = 0;
	for(auto it = race1.begin(); cnt < 4; it++){
			if(cnt<2) cout << it->second << " " << it->first << endl;
			else top.insert(make_pair(it->first, it->second));
			cnt++;
		}
	for(auto it = race2.begin(); cnt < 8; it++){
			if(cnt<6) cout << it->second << " " << it->first << endl;
			else top.insert(make_pair(it->first, it->second));
			cnt++;
		}
	for(auto it = race3.begin(); cnt < 12; it++){
			if(cnt<10) cout << it->second << " " << it->first << endl;
			else top.insert(make_pair(it->first, it->second));
			cnt++;
		}
	for(auto it = top.begin(); cnt < 14; it++){
			cout << it->second << " " << it->first << endl;
			cnt++;
		}


}

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, number, cnt = 0, idx = 0;
//    double time;
//    Smap rec[50];
//    map<int, double> data;
//
//    //入力
//    for(i = 0;i < 24; i++){
//        scanf("%d %lf", &number, &time);
//        data[number] = time;
//    }
//    
//    
//    //map-構造体変換
//    for(auto &p: data){
//        rec[cnt] = (Smap){p.first, p.second};
//        cnt++;
//    }
//    
//    //3組ごとのソート
//    for(i = 0; i < 17; i += 8){
//        sort(rec + i, rec + i + 7, tfsort);
//    }
//    printf("---------------------\n");
//    //上位二組出力
//    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;
//}
#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, number, cnt = 0, idx = 0;
    double time;
    Smap rec[50];
    map<int, double> data;
    
    //入力
    for(i = 0;i < 24; i++){
        scanf("%d %lf", &number, &time);
        data[number] = time;
    }
    
    
    //map-構造体変換
    for(auto &p: data){
        rec[cnt] = (Smap){p.first, p.second};
        cnt++;
    }
    
    //3組ごとのソート
    for(i = 0; i < 17; i += 8){
        sort(rec + i, rec + i + 8, tfsort);
    }
    printf("---------------------\n");
    //上位二組出力
    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 = 999999;
        rec[idx + 1].time = 999999;
        idx += 8;
    }
    
    //全てのチームをソート
    sort(rec, rec + 24, tfsort);
    
    //3位以下の上位二人を出力
    for(i = 0; i < 2; 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;
}