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 <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 %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", p4[i].second, p4[i].first), c++;
	}
	return 0;
}

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

#define f first
#define s second
#define mp make_pair

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

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  vector<pair<double,int> > vv(18);
  REP(i,3){
    vector<pair<double,int> > v(8);
    REP(j,8)
      cin>>v[j].s>>v[j].f;
    sort(v.begin(),v.end());
    REP(j,6) vv[i*6 + j] = v[j+2];
    printf("%d %.2f\n",v[0].s,v[0].f);
    printf("%d %.2f\n",v[1].s,v[1].f);
  }
  sort(vv.begin(),vv.end());
  printf("%d %.2f\n",vv[0].s,vv[0].f);
  printf("%d %.2f\n",vv[1].s,vv[1].f);
  return 0;
}

C++: //#include <stdio.h>
//#include <map>
//#include <string>
//#include <algorithm>
//
//using namespace std;
//
//struct smap {
//    int number;
//    double time;
//};typedef struct smap Smap;
//
////プロトタイプ宣言
//bool tfsort (const Smap &a, const Smap &b);
//
////main関数
//int main(){
//    int i, number, cnt = 0, idx = 0;
//    double time;
//    Smap rec[50];
//    map<int, double> data;
//
//    //入力
//    for(i = 0;i < 24; i++){
//        scanf("%d %lf", &number, &time);
//        data[number] = time;
//    }
//    
//    
//    //map-構造体変換
//    for(auto &p: data){
//        rec[cnt] = (Smap){p.first, p.second};
//        cnt++;
//    }
//    
//    //3組ごとのソート
//    for(i = 0; i < 17; i += 8){
//        sort(rec + i, rec + i + 7, tfsort);
//    }
//    printf("---------------------\n");
//    //上位二組出力
//    for(i = 0; i < 3; i++){
//        printf("%d %0.2f\n", rec[idx].number, rec[idx].time);
//        printf("%d %0.2f\n", rec[idx + 1].number, rec[idx + 1].time);
//        rec[idx].time = -1.0;
//        rec[idx + 1].time = -1.0;
//        idx += 8;
//    }
//    
//    //全てのチームをソート
//    sort(rec, rec + 24, tfsort);
//    
//    //3位以下の上位二人を出力
//    for(i = 6; i < 8; i++){
//        printf("%d %0.2f\n", rec[i].number, rec[i].time);
//    }
//    
//    return 0;
//}
//
//bool tfsort (const Smap &a, const Smap &b){
//    if(a.time < b.time) return true;
//    return false;
//}
#include <stdio.h>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

struct smap {
    int number;
    double time;
};typedef struct smap Smap;

//プロトタイプ宣言
bool tfsort (const Smap &a, const Smap &b);

//main関数
int main(){
    int i, number, cnt = 0, idx = 0;
    double time;
    Smap rec[50];
    map<int, double> data;
    
    //入力
    for(i = 0;i < 24; i++){
        scanf("%d %lf", &number, &time);
        data[number] = time;
    }
    
    
    //map-構造体変換
    for(auto &p: data){
        rec[cnt] = (Smap){p.first, p.second};
        cnt++;
    }
    
    //3組ごとのソート
    for(i = 0; i < 17; i += 8){
        sort(rec + i, rec + i + 8, tfsort);
    }
//    printf("---------------------\n");
    //上位二組出力
    for(i = 0; i < 3; i++){
        printf("%d %0.2f\n", rec[idx].number, rec[idx].time);
        printf("%d %0.2f\n", rec[idx + 1].number, rec[idx + 1].time);
        rec[idx].time = 999999;
        rec[idx + 1].time = 999999;
        idx += 8;
    }
    
    //全てのチームをソート
    sort(rec, rec + 24, tfsort);
    
    //3位以下の上位二人を出力
    for(i = 0; i < 2; i++){
        printf("%d %0.2f\n", rec[i].number, rec[i].time);
    }
    
    return 0;
}

bool tfsort (const Smap &a, const Smap &b){
    if(a.time < b.time) return true;
    return false;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<double, int> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(2);
    vector<P> ans;
    priority_queue<P, vector<P>, greater<P>> que;
    for(int i = 0; i < 3; i++)
    {
        priority_queue<P, vector<P>, greater<P>> tmp;
        for(int j = 0; j < 8; j++)
        {
            int p; cin >> p;
            double t; cin >> t;
            tmp.push(P(t, p));
        }
        ans.push_back(tmp.top()); tmp.pop();
        ans.push_back(tmp.top()); tmp.pop();
        while(tmp.size())
        {
            que.push(tmp.top());
            tmp.pop();
        }
    }
    for(int i = 0; i < 6; i++)
    {
        ans.push_back(que.top());
        que.pop();
    }
    for(int i = 0; i < 8; i++) cout << ans[i].second << " " << ans[i].first << endl;
    return 0;
}