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<algorithm>
#include<iostream>
#include<iomanip>
#include<vector>

typedef std::pair<double, int> P;
std::vector<P> v[4];

int main()
{
	for( int i = 0; i != 24; ++i )
	{
		int n;
		double t;
		std::cin >> n >> t;

		v[i/8].push_back( P( t, n ) );
	}

	for( int i = 0; i != 3; ++i )
		std::sort( v[i].begin(), v[i].end() );

	for( int i = 0; i != 3; ++i )
		for( int j = 2; j != 8; ++j )
			v[3].push_back( v[i][j] );

	std::sort( v[3].begin(), v[3].end() );

	for( int i = 0; i != 4; ++i )
		for( int j = 0; j != 2; ++j )
			std::cout << v[i][j].second << ' ' << std::fixed << std::setprecision( 2 ) << v[i][j].first << std::endl;

	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>


typedef long long ll;
const double Eps = 1e-6;

using namespace std;

int main()
{
	pair<double ,int> runners[24];
	for (int i = 0; i < 24; ++i)
	{
		int a;
		double b;
		scanf("%d %lf", &a ,&b);
		runners[i] = make_pair(b, a);
	}
	for (int i = 0; i < 3; ++i)
	{
		sort(runners+i*8, runners+8+i*8);
		printf("%d %.2f\n", runners[0 + i*8].second, runners[0 + i*8].first);
		printf("%d %.2f\n", runners[1 + i*8].second, runners[1 + i*8].first);
		runners[0 + i*8].first = runners[1 + i*8].first = 1e10;
	}
	sort(runners, runners+24);
	printf("%d %.2f\n", runners[0].second, runners[0].first);
	printf("%d %.2f\n", runners[1].second, runners[1].first);

	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

struct Player {
  int number;
  float rec;
  bool operator<(const Player& a) const { return rec < a.rec; }
};

int main() {
  vector<Player> v;
  rep (i,3) {
    Player players[8];
    rep (j,8) {
      cin >> players[j].number >> players[j].rec;
    }
    sort(players, players + 8);
    rep (j,2) {
      printf("%d %.2lf\n", players[j].number, players[j].rec);
    }
    v.push_back(players[2]);
  }
  sort(v.begin(), v.end());
  rep (i,2) {
    printf("%d %.2lf\n", v[i].number, v[i].rec);
  }
  return 0;
}

C++: #include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

struct Info{
	int id;
	double time_record;
};

int main(){

	Info group1[8],group2[8],group3[8],rest[6];

	for(int i = 0; i < 8; i++){
		scanf("%d %lf",&group1[i].id,&group1[i].time_record);
	}
	for(int i = 0; i < 8; i++){
		scanf("%d %lf",&group2[i].id,&group2[i].time_record);
	}
	for(int i = 0; i < 8; i++){
		scanf("%d %lf",&group3[i].id,&group3[i].time_record);
	}

	for(int i=1; i <= 7; i++){
		for(int k=7; k >= i; k--){
			if(group1[k].time_record < group1[k-1].time_record)swap(group1[k],group1[k-1]);
			if(group2[k].time_record < group2[k-1].time_record)swap(group2[k],group2[k-1]);
			if(group3[k].time_record < group3[k-1].time_record)swap(group3[k],group3[k-1]);
		}
	}

	rest[0] = group1[2];
	rest[1] = group1[3];
	rest[2] = group2[2];
	rest[3] = group2[3];
	rest[4] = group3[2];
	rest[5] = group3[3];

	for(int i=1; i <= 5; i++){
		for(int k=5; k >= i; k--){
			if(rest[k].time_record < rest[k-1].time_record)swap(rest[k],rest[k-1]);
		}
	}

	printf("%d %.2lf\n",group1[0].id,group1[0].time_record);
	printf("%d %.2lf\n",group1[1].id,group1[1].time_record);
	printf("%d %.2lf\n",group2[0].id,group2[0].time_record);
	printf("%d %.2lf\n",group2[1].id,group2[1].time_record);
	printf("%d %.2lf\n",group3[0].id,group3[0].time_record);
	printf("%d %.2lf\n",group3[1].id,group3[1].time_record);
	printf("%d %.2lf\n",rest[0].id,rest[0].time_record);
	printf("%d %.2lf\n",rest[1].id,rest[1].time_record);


	return 0;
}

C++: #include <cstdio>
#include <map>
#include <algorithm>
using namespace std;
pair<double, int> a[3][8], b[18], res[8];
int main()
{
    for (int i = 0; i < 24; ++i) {
        int t;
        double f;
        scanf("%d%lf", &t, &f);
        a[i / 8][i % 8] = make_pair(f, t);
    }
    int k = 0, l = 0;
    for (int i = 0; i < 3; ++i) {
        sort(a[i], a[i]+8);
        res[k++] = a[i][0];
        res[k++] = a[i][1];
        for (int j = 2; j < 8; ++j) b[l++] = a[i][j];
    }
    sort(b, b+18);
    res[k++] = b[0];
    res[k++] = b[1];
    for (int i = 0; i < 8; ++i)
        printf("%d %.2f\n", res[i].second, res[i].first);
    return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	vector<pair<double,int> > v,v1,v2,temp;
	int a;
	double b;
	
	rep(i,8)
	{
		cin >> a >> b;
		v.push_back(make_pair(b,a));
	}

	rep(i,8)
	{
		cin >> a >> b;
		v1.push_back(make_pair(b,a));
	}

	rep(i,8)
	{
		cin >> a >> b;
		v2.push_back(make_pair(b,a));
	}

	sort(v.begin(),v.end());
	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());
	
	cout << fixed;
	cout.precision(2);

	REP(i,2,4)
	{
		temp.push_back(v[i]);
		temp.push_back(v1[i]);
		temp.push_back(v2[i]);
	}

	sort(temp.begin(),temp.end());

	rep(i,2) cout << v[i].second << " " << v[i].first << endl;
	rep(i,2) cout << v1[i].second << " " << v1[i].first << endl;
	rep(i,2) cout << v2[i].second << " "<< v2[i].first << endl;
	rep(i,2) cout << temp[i].second << " " <<temp[i].first << endl;
	return 0;
}