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<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  vector< pair<double,int> > v1(8),v2(8),v3(8);

  rep(i,8)cin>>v1[i].second>>v1[i].first;
  rep(i,8)cin>>v2[i].second>>v2[i].first;
  rep(i,8)cin>>v3[i].second>>v3[i].first;

  sort(all(v1));
  sort(all(v2));
  sort(all(v3));

  cout<<shosu(2)<<v1[0].second<<" "<<v1[0].first<<endl;
  cout<<shosu(2)<<v1[1].second<<" "<<v1[1].first<<endl;
  cout<<shosu(2)<<v2[0].second<<" "<<v2[0].first<<endl;
  cout<<shosu(2)<<v2[1].second<<" "<<v2[1].first<<endl;
  cout<<shosu(2)<<v3[0].second<<" "<<v3[0].first<<endl;
  cout<<shosu(2)<<v3[1].second<<" "<<v3[1].first<<endl;

  vector< pair<double,int> > p(18);
  rep(i,6)p[i]=v1[i+2];
  rep(i,6)p[6+i]=v2[i+2];
  rep(i,6)p[12+i]=v3[i+2];
  sort(all(p));

  cout<<shosu(2)<<p[0].second<<" "<<p[0].first<<endl;
  cout<<shosu(2)<<p[1].second<<" "<<p[1].first<<endl;

}

C++: #include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
typedef pair<float,int> A;
int main(void)
{
	A a[9],b[9],c[9],d[19];
	int i;
	for(i=1;i<=8;i++){
		scanf("%d %f",&a[i].second,&a[i].first);
	}
	sort(a,a+8);
	for(i=1;i<=2;i++){
		printf("%d %f\n",a[i].second,a[i].first);
	}
	
	for(i=1;i<=8;i++){
		scanf("%d %f",&b[i].second,&b[i].first);
	}
	sort(b,b+8);
	for(i=1;i<=2;i++){
		printf("%d %f\n",b[i].second,b[i].first);
	}
	
	for(i=1;i<=8;i++){
		scanf("%d %f",&c[i].second,&c[i].first);
	}
	sort(c,c+8);
	for(i=1;i<=2;i++){
		printf("%d %f\n",c[i].second,c[i].first);
	}
	
	for(i=1;i<=6;i++){
		d[i].first=a[i+2].first;
		d[i].second=a[i+2].second;
	}	
	for(i=1;i<=6;i++){
		d[i+6].first=b[i+2].first;
		d[i+6].second=b[i+2].second;
	}	
	for(i=1;i<=6;i++){
		d[i+12].first=c[i+2].first;
		d[i+12].second=c[i+2].second;
	}
	sort(d,d+18);
	for(i=1;i<=2;i++){
		printf("%d %f\n",d[i].second,d[i].first);
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.track", "r", stdin );
	string str = "";
	int n = 24;
	int i,j;

	map<double, pair<int, int> > race; // time, number of person, number of race

	for (i = 0; i < n; ++i){
		int number = 0;
		double time = 0.0;

		getline (cin, str );
		stringstream ss (str );

		ss >> number >> time;

		race.insert (make_pair (time, make_pair (number, i / 8) ) );
	} // end for
	
	vector<map<double, int> > res;

	for (i = 0; i < 4; ++i){
		j = 0;
		map<double, pair<int, int> >::iterator it = race.begin();
		for (; it != race.end(); ++it ){
			double time = (*it).first;
			double num  = (*it).second.first;
			double ra   = (*it).second.second;
			if (( i == 3 || ra == i ) && j < 2){
				map<double, int> r;
				r.insert (make_pair (time, num ) );
				res.push_back (r);
				++j;
				race.erase (it);
			} // end if
		} // end for
	} // end for

	for (i = 0; i < 8; ++i){
		map<double, int>::iterator itres = res[i].begin();
		for (; itres != res[i].end(); ++itres){
			double time = (*itres).first;
			int num = (*itres).second;
			printf ("%d %.2f\n", num, time );
		} // end for
	} // end for

	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, 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 < 24; 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 = -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;
}

C++: #include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define fr first
#define sc second
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> pip; 
const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main() {

  map<double, int> group[3];
  map<double, int> all;

  for(int i=0; i<3; i++) {
    for(int j=0; j<8; j++) {
      int num; double time;
      cin>> num>> time;
      group[i][time] = num;
    }

    map<double, int>::iterator it = group[i].begin();
    cout<< (*it).sc<< " "<< (*it).fr<< endl; it++;
    cout<< (*it).sc<< " "<< (*it).fr<< endl;

    int n=6;
    while(n--) {
      it++;
      all[(*it).fr] = (*it).sc;
    }
  }

  map<double, int>::iterator it = all.begin();
  cout<< (*it).sc<< " "<< (*it).fr<< endl; it++;
  cout<< (*it).sc<< " "<< (*it).fr<< endl;
}