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 <queue>
#include <map>
#include <utility>
using namespace std;
using namespace std::rel_ops;

#define PAIR pair<double, int>

/**********オーバーロード**********/
bool operator>(const PAIR &a, const PAIR &b){	
	return a.first > b.first;
}
bool operator<(const PAIR &a, const PAIR &b){	
	return a.first < b.first;
}


int main(){
	priority_queue<PAIR, vector<PAIR>, greater<PAIR> > race1, race2, race3, fainal;
	//map<double, int>fainal;

	for(int i = 0; i < 8; i++){
		int player;
		double tim;
		cin >> player >> tim;
		race1.push(PAIR(tim, player));
	}
	for(int i = 0; i < 8; i++){
		int player;
		double tim;
		cin >> player >> tim;
		race2.push(PAIR(tim, player));
	}
	for(int i = 0; i < 8; i++){
		int player;
		double tim;
		cin >> player >> tim;
		race3.push(PAIR(tim, player));
	}

	//上位２位
	for(int i = 0; i < 2; i++){
		cout << race1.top().second << " " << race1.top().first << endl;
		race1.pop();
	}
	for(int i = 0; i < 2; i++){
		cout << race2.top().second << " " << race2.top().first << endl;
		race2.pop();
	}
	for(int i = 0; i < 2; i++){
		cout << race3.top().second << " " << race3.top().first << endl;
		race3.pop();
	}

	//Time抜け
	for(int i = 0; i < 2; i++){
		fainal.push(race1.top());
		race1.pop();
	}
	for(int i = 0; i < 2; i++){
		fainal.push(race2.top());
		race2.pop();
	}
	for(int i = 0; i < 2; i++){
		fainal.push(race3.top());
		race3.pop();
	}
	for(int i = 0; i < 2; i++){
		cout << fainal.top().second << " " << fainal.top().first << endl;
		fainal.pop();
	}

}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int a[3][3];
	double d[3][3];
	for(int p=0;p<3;p++){
	for(int i=0;i<8;i++){
		int b;
		double c;
		cin>>b>>c;
		for(int j=0;j<3;j++){
			if(c<d[p][j]){
				double e=d[p][0];
				int f=0;
				for(int z=0;z<3;z++){
					if(e>d[p][z]){
						f=z;
						e=d[p][z];
					}
				}
				d[p][f]=c;
				a[p][f]=b;
				break;
			}
		}
	}
	}
	int l[3];
	double m[3];
	for(int i=0;i<3;i++){
		int g=10000;
		int h,k;
		for(int j=0;j<3;j++){
			if(g>d[i][j]){g=d[i][j];h=j;}
		}
		cout<<a[i][h]<<" "<<d[i][h]<<endl;
		g=10000;
		for(int j=0;j<3;j++){
			if(g>d[i][j]&&j!=h){g=d[i][j];k=j;}
		}
		cout<<a[i][k]<<" "<<d[i][h]<<endl;
		for(int j=0;j<3;j++){
			if(j!=h&&j!=k){l[i]=a[i][j];m[i]=d[i][j];}
		}
	}
	int n=10000;
	int o,p;
	for(int j=0;j<3;j++){
		if(n>l[j]){n=l[j];o=j;}
	}
	cout<<m[o]<<" "<<l[o]<<endl;
	n=10000;
	for(int j=0;j<3;j++){
		if(n>l[j]&&j!=o){n=l[j];p=j;}
	}
	cout<<m[p]<<" "<<l[p]<<endl;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
#include<cstdio>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

typedef pair<double, int> pp;

int main()
{
    vector<pp> t[3];
    vector<pp> ans;
    vector<pp> rest;

    double d;
    int n;
    REP(3)
    {
        rep(j,8)
        {
            cin >> n >> d;
            t[i].push_back(pp(d,n));
        }
        sort(all(t[i]));
        printf("%d %.2f\n", t[i][0].second, t[i][0].first);
        printf("%d %.2f\n", t[i][1].second, t[i][1].first);
        //ans.push_back(t[i][0]); ans.push_back(t[i][1]);
        for(int s = 2;s<8;s++)rest.push_back(t[i][s]);
    }
    sort(all(rest));
    //ans.push_back(rest[0]); ans.push_back(rest[1]);
    printf("%d %.2f\n", rest[0].second, rest[0].first);
    printf("%d %.2f\n", rest[1].second, rest[1].first);

    sort(all(ans));
    //REP(8) printf("%d %.2f", ans[i].second, ans[i].first);
    return 0;
}

C++: #include <iostream>
#include <functional>
#include <vector>
#include <cstdio>
#include <algorithm>

using namespace std;

class Player{
public:
	int number;
	double time;
	
	Player(){
		number = 0;
		time = 0;
	}
	
	bool operator<( const Player& lhs ) const{
		return time < lhs.time;
	}
	bool operator>( const Player& lhs ) const{
		return time > lhs.time;
	}
};

int main(int argc, char const* argv[])
{
	vector<Player> race1( 8 );
	vector<Player> race2( 8 );
	vector<Player> race3( 8 );
	vector<Player> race( 18 );

	for( int i = 0;i < 8;i++ ){
		cin >> race1[i].number;
		cin >> race1[i].time;
	}
	for( int i = 0;i < 8;i++ ){
		cin >> race2[i].number;
		cin >> race2[i].time;
	}
	for( int i = 0;i < 8;i++ ){
		cin >> race3[i].number;
		cin >> race3[i].time;
	}

	sort( race1.begin(), race1.end(), greater<Player>() );

	printf("%d %.2f\n",race1[7].number, race1[7].time );
	printf("%d %.2f\n",race1[6].number, race1[6].time );
	race1.pop_back();
	race1.pop_back();

	sort( race2.begin(), race2.end() , greater<Player>());

	printf("%d %.2f\n",race2[7].number, race2[7].time );
	printf("%d %.2f\n",race2[6].number, race2[6].time );

	race2.pop_back();
	race2.pop_back();
	sort( race3.begin(), race3.end(), greater<Player>() );

	printf("%d %.2f\n",race3[7].number, race3[7].time );
	printf("%d %.2f\n",race3[6].number, race3[6].time );
	race3.pop_back();
	race3.pop_back();

	for( int i = 0;i < 6;i++ ){
		race[i] = race1[i];
		race[i + 6] = race2[i];
		race[i + 12] = race3[i];
	}

	sort( race.begin(), race.end(), greater<Player>() );

	
	printf("%d %.2f\n",race[17].number, race[17].time );
	printf("%d %.2f\n",race[16].number, race[16].time );
	return 0;
}