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++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
int main(){
	
	map<double,string> s;
	vector<double> t1(8);
	vector<double> t2(8);
	vector<double> t3(8);
	vector<double> t4;
	for(int i=0;i<8;i++){
		string a;
		cin>>a>>t1[i];
		s[t1[i]]=a;
	}
	for(int i=0;i<8;i++){
		string a;
		cin>>a>>t2[i];
		s[t2[i]]=a;
	}
	for(int i=0;i<8;i++){
		string a;
		cin>>a>>t3[i];
		s[t3[i]]=a;
	}
	
	
	sort(t1.begin(),t1.end());
	sort(t2.begin(),t2.end());
	sort(t3.begin(),t3.end());
	
	for(int i=2;i<8;i++){
		t4.push_back(t1[i]);
		t4.push_back(t2[i]);
		t4.push_back(t3[i]);
	}
	sort(t4.begin(),t4.end());
	
	
	cout<<s[t1[0]]<<" "<<t1[0]<<endl;
	cout<<s[t1[1]]<<" "<<t2[1]<<endl;
	cout<<s[t2[0]]<<" "<<t2[0]<<endl;
	cout<<s[t2[1]]<<" "<<t2[1]<<endl;
	cout<<s[t3[0]]<<" "<<t3[0]<<endl;
	cout<<s[t3[1]]<<" "<<t3[1]<<endl; 
	cout<<s[t4[0]]<<" "<<t4[0]<<endl;
	cout<<s[t4[1]]<<" "<<t4[1]<<endl;
	
	
	
	
}

C++: #include <stdio.h>
#include <algorithm>
using namespace std;
pair<double, int> p1[8], p2[8], p3[8], p4[24];
int main() {
	for(int i = 0; i < 8; i++) scanf("%d %lf", &p1[i].second, &p1[i].first), p4[i] = p1[i]; sort(p1, p1 + 8);
	for(int i = 0; i < 8; i++) scanf("%d %lf", &p2[i].second, &p2[i].first), p4[i + 8] = p2[i]; sort(p2, p2 + 8);
	for(int i = 0; i < 8; i++) scanf("%d %lf", &p3[i].second, &p3[i].first), p4[i + 16] = p3[i]; sort(p3, p3 + 8);
	printf("%d %.2f\n%d %.2f\n", p1[0].second, p1[0].first, p1[1].second, p1[1].first);
	printf("%d %.2f\n%d %.2f\n", p2[0].second, p2[0].first, p2[1].second, p2[1].first);
	printf("%d %.2f\n%d %.2f\n", p3[0].second, p3[0].first, p3[1].second, p3[1].first);
	sort(p4, p4 + 24);
	for(int i = 0, c = 0; c < 2; i++) {
		int s = p4[i].second; bool flag = true;
		flag = flag && (s != p1[0].second && s != p2[0].second && s != p3[0].second);
		flag = flag && (s != p1[1].second && s != p2[1].second && s != p3[1].second);
		if(flag) printf("%d %.2f\n", p4[i].second, p4[i].first), c++;
	}
	return 0;
}

C++: #include <iostream>
#include <map>
#include <iomanip>
using namespace std;
class Data {
    public:
        Data(int max);
        ~Data();
        void add(int, double);
        int getNum(int n);
        double getTime(int n);

    private:
        int* num;
        double* time;
        int max;
        int now_n;
};
Data::Data(int max){
    num = new int[max];
    time = new double[max];
    for(int i = 0; i < max; ++i) {
        num[i] = 0;
        time[i] = 0;
    }
    this->max = max;
    now_n = 0;
}
Data::~Data(){
    delete num;
    delete time;
}
void Data::add(int n, double t){
    if (now_n >= max) {
        return;
    }
    num[now_n] = n;
    time[now_n] = t;
    ++now_n;
}
int Data::getNum(int n){
    return num[n];
}
double Data::getTime(int n){
    return time[n];
}
#define MEMBER 8
#define RACE 3
int main(){
    map<double, int> course, ans, tmp;
    int num;
    double in;
    Data data(MEMBER);
    int count;
    int race = RACE;
    while(race--) {
        course.clear();
        for (int i = 0; i < MEMBER; i++) {
            cin >> num >> in;
            course.insert( map<double, int>::value_type(in , num));
        }
        count = 0;
        for(map<double, int>::iterator it = course.begin(); it != course.end(); ++it) {
            if ((count++) < 2) {
                data.add(it->second , it->first);
            }
            else {
                tmp.insert( map<double, int>::value_type(it->first, it->second));
            }
        }
    }
    count = 2;
    for(map<double, int>::iterator it = tmp.begin(); it != tmp.end(); ++it) {
        if (count-- <= 0) {
            break;
        }
        data.add(it->second, it->first);
    }
    //output
    for(int i = 0; i < MEMBER; ++i) {
        cout<< showpoint << data.getNum(i) << " " << setprecision(4) << data.getTime(i) << endl;
    }
}

C++: #include <stdio.h>
#include <algorithm>
using namespace std;
pair<double, int> p1[8], p2[8], p3[8], p4[24];
int main() {
	for(int i = 0; i < 8; i++) scanf("%d %lf", &p1[i].second, &p1[i].first), p4[i] = p1[i]; sort(p1, p1 + 8);
	for(int i = 0; i < 8; i++) scanf("%d %lf", &p2[i].second, &p2[i].first), p4[i + 8] = p1[i]; sort(p2, p2 + 8);
	for(int i = 0; i < 8; i++) scanf("%d %lf", &p3[i].second, &p3[i].first), p4[i + 16] = p1[i]; sort(p3, p3 + 8);
	printf("%d %lf\n%d %lf\n", p1[0].second, p1[0].first, p1[1].second, p1[1].first);
	printf("%d %lf\n%d %lf\n", p2[0].second, p2[0].first, p2[1].second, p2[1].first);
	printf("%d %lf\n%d %lf\n", p3[0].second, p3[0].first, p3[1].second, p3[1].first);
	sort(p4, p4 + 24);
	for(int i = 0, c = 0; c < 2; i++) {
		int s = p4[i].second; bool flag = true;
		flag = flag && (s != p1[0].second && s != p2[0].second && s != p3[0].second);
		flag = flag && (s != p1[1].second && s != p2[1].second && s != p3[1].second);
		if(flag) printf("%d %lf\n", p1[i].second, p1[i].first), c++;
	}
	return 0;
}