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 <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

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

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(p - l.first, l.first - l.second) / norm(l.first - l.second);
	return l.first + t * (l.first - l.second);
}

bool intersectSP(const line &l, const xy_t &p){
	return abs(l.first- p) + abs(l.second - p) - abs(l.first - l.second) < EPS;
}

double distanceSP(line s, xy_t p){
	const xy_t r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s.first - p), abs(s.second - p));
}


struct data{
	int id;
	int g;
	double d;
	data(){};
	data(int id, int g, double d){
		this-> id = id;
		this->g = g;
		this->d = d;
	}
};

bool comp(data d1, data d2){
	return d1.d < d2.d;
}

data ds[24];
bool used[24];

int main(){
	fill(used, used + 24,false);
	rep(i, 24){
		cin >> ds[i].id >> ds[i].d;
		ds[i].g = i / 8;
	}
	sort(ds, ds + 24, comp);
	int cnt = 0;
	rep(i, 24){
		if(cnt < 2 && !used[i] && ds[i].g == 0){
			cnt++;
			used[i] = true;
			cout << fixed << setprecision(2) <<  ds[i].id << " " << ds[i].d << endl;
		}
	}
	cnt = 0;
	rep(i, 24){
			if(cnt < 2 && !used[i] && ds[i].g == 1){
			cnt++;
			used[i] = true;
			cout << ds[i].id << " " << ds[i].d << endl;
		}
	}
	cnt = 0;
	rep(i, 24){
		if(cnt < 2 && !used[i] && ds[i].g == 2){
			cnt++;
			used[i] = true;
			cout << ds[i].id << " " << ds[i].d << endl;
		}
	}
	cnt = 0;
	rep(i, 24){
		if(cnt < 2 && !used[i]){
			cnt++;
			used[i] = true;
			cout << ds[i].id << " " << ds[i].d << endl;
		}
	}
	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;
}

C++: #include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

int main(){

	pair<double,int> info;
	pair<double,int> data[3][8];
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 8; j++){
			cin>>data[i][j].second>>data[i][j].first;
		}
	}
	for(int i = 0; i < 3; i++)
		sort(data[i],data[i]+8);

	pair<double,int> lose[18];
	int idx=0;
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 8; j++){
			if(j<=1){
				cout<<data[i][j].second<<" "<<data[i][j].first<<endl;
			}
			else{
				lose[idx].first=data[i][j].first;
				lose[idx].second=data[i][j].second;
				idx++;
			}
		}
	}
	sort(lose,lose+18);
	for(int i = 0; i < 2; i++){
		cout<<lose[i].second<<" "<<lose[i].first<<endl;
	}
	

	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int main (){
    map< double , int > a[3];
    map< double , int > b;
    for(int i=0;i<3;i++){
        for(int j=0;j<8;j++){
           int x;
           double y;
           cin>>x>>y;
           a[i][y] = x;
        }
        map< double , int >::iterator it = a[i].begin();
        cout<<(*it).second<<" "<<(*it).first<<endl;
        it++;
        cout<<(*it).second<<" "<<(*it).first<<endl;

        int n=6;
        while(n--){
            it++;
            b[(*it).first] = (*it).second;
        }


    }
    map< double , int >::iterator it = b.begin();
        cout<<(*it).second<<" "<<(*it).first<<endl;
        it++;
        cout<<(*it).second<<" "<<(*it).first<<endl;

    for(int i=0;i<3;i++)a[i].clear();
    b.clear();
    return 0;
}