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 <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };



vector<pair<double, int> > ans;

vector<pair<double, int> > b;

int main() {
	for ( int i = 0; i < 3; i++ ) {
		vector<pair<double, int> > a( 8 );
		for ( int j = 0; j < 8; j++ ) {
			scanf( "%d %lf", &a[ j ].second, &a[ j ].first );
		}
		sort( a.begin(), a.end() );
		ans.insert( ans.end(), a.begin(), a.begin() + 2 );
		a.erase( a.begin(), a.begin() + 2 );
		b.insert( b.end(), a.begin(), a.end() );
	}
	sort( b.begin(), b.end() );
	ans.insert( ans.end(), b.begin(), b.begin() + 2 );
	for ( int i = 0; i < ans.size(); i++ ) {
		printf( "%d %.2lf\n", ans[ i ].second, ans[ i ].first );
	}
	return 0;
}

C++: #include <bits/stdc++.h>

struct player {
    int id;
    double t;
};

bool cmp(player const &lhs, player const &rhs) {
    return lhs.t < rhs.t;
}
void print(player const &p) {
    std::cout << p.id << " " << std::fixed << std::setprecision(2) << p.t << std::endl;
}

int main(void)
{
    std::vector<player> g[3];

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 8; j++) {
            player p;
            std::cin >> p.id >> p.t;
            g[i].emplace_back(p);
        }
    }

    for (int i = 0; i < 3; i++) {
        std::sort(g[i].begin(), g[i].end(), cmp);
    }

    std::vector<player> rest;

    for (int i = 0; i < 3; i++) {
        print(g[i][0]);
        print(g[i][1]);
        std::copy(g[i].begin() + 2, g[i].end(), std::back_inserter(rest));
    }

    std::sort(rest.begin(), rest.end(), cmp);

    print(rest[0]);
    print(rest[1]);

    return 0;
}

C++: #include<stdio.h>   
#include<iostream>
using namespace std;

struct ply{int cl;int nu;int m;int s;int A;};

int main()
{

ply NUM[4][9],M1,M2,M3,T;
for(int ii=0;ii<3;ii++)
{
	
	for(int i=0;i<8;i++)
	{
		NUM[ii][i].cl=ii;
		scanf("%d %d.%d",&NUM[ii][i].nu,&NUM[ii][i].m,&NUM[ii][i].s);
		NUM[ii][i].A=100*NUM[ii][i].m+NUM[ii][i].s;
	}
	for(int i=0;i<8;i++){
		for(int j=7;j>i;j--){
			if(NUM[ii][j-1].A>NUM[ii][j].A){ply Te=NUM[ii][j];NUM[ii][j]=NUM[ii][j-1];NUM[ii][j-1]=Te;}
		}
	}
}
M1=NUM[0][2];M2=NUM[1][2];M3=NUM[2][2];
if(M1.A<M2.A)swap(M1,M2);
if(M1.A<M3.A)swap(M1,M3);
if(M2.A<M3.A)swap(M2,M3);
for(int i=0;i<2;i++){
		for(int j=0;j<1;j++){
			if(NUM[i][j].s/10>0)cout<<NUM[i][j].nu<<" "<<NUM[i][j].m<<"."<<NUM[i][j].s<<endl;
			else if(NUM[i][j].s/10==0)cout<<NUM[i][j].nu<<" "<<NUM[i][j].m<<"."<<"0"<<NUM[i][j].s<<endl;
		}
}
if(M3.s/10>0)cout<<M3.nu<<" "<<M3.m<<"."<<M3.s<<endl;
else if(M3.s/10==0)cout<<M3.nu<<" "<<M3.m<<"."<<"0"<<M3.s<<endl;

if(M2.s/10>0)cout<<M2.nu<<" "<<M2.m<<"."<<M2.s<<endl;
else if(M2.s/10==0)cout<<M2.nu<<" "<<M2.m<<"."<<"0"<<M2.s<<endl;

return 0;
}

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

#define f first
#define s second

using namespace std;

int main(){
  vector<pair<double, int> > t1(8), t2(8), t3(8), t4;
  
  for(int i = 0 ; i < 8 ; i++) cin >> t1[i].s >> t1[i].f;
  for(int i = 0 ; i < 8 ; i++) cin >> t2[i].s >> t2[i].f;
  for(int i = 0 ; i < 8 ; i++) cin >> t3[i].s >> t3[i].f;
  
  sort(t1.begin(), t1.end());
  sort(t2.begin(), t2.end());
  sort(t3.begin(), t3.end());
  
  for(int i = 2 ; i < 4 ; i++){
    t4.push_back(t1[i]);
    t4.push_back(t2[i]);
    t4.push_back(t3[i]);
  }
  
  sort(t4.begin(), t4.end());
  cout.precision(4);
  cout.setf(ios::showpoint);
  for(int i = 0 ; i < 2 ; i++) cout << t1[i].s << ' ' << t1[i].f << endl;
  for(int i = 0 ; i < 2 ; i++) cout << t2[i].s << ' ' << t2[i].f << endl;
  for(int i = 0 ; i < 2 ; i++) cout << t3[i].s << ' ' << t3[i].f << endl;
  for(int i = 0 ; i < 2 ; i++) cout << t4[i].s << ' ' << t4[i].f << endl;
  return 0;
}