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 <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(void){
	vector<pair<double,int> > v[3],vall;
	double time;
	int num;
	
	for(int i=0;i<24;i++){
		cin >> num >> time;
		if(i < 8){
			v[0].push_back(make_pair(time,num));
		}else if(i < 16){
			v[1].push_back(make_pair(time,num));
		}else{
			v[2].push_back(make_pair(time,num));
		}
	}
	sort(v[0].begin(),v[0].end());
	sort(v[1].begin(),v[1].end());
	sort(v[2].begin(),v[2].end());
	
	cout << v[0][0].second << " " << v[0][0].first << endl;
	cout << v[0][1].second << " " << v[0][1].first << endl;
	cout << v[1][0].second << " " << v[1][0].first << endl;
	cout << v[1][1].second << " " << v[1][1].first << endl;
	cout << v[2][0].second << " " << v[2][0].first << endl;
	cout << v[2][1].second << " " << v[2][1].first << endl;
	
	for(int i=2;i<8;i++){
		vall.push_back(v[0][i]);
		vall.push_back(v[1][i]);
		vall.push_back(v[2][i]);
	}
	
	sort(vall.begin(), vall.end());
	
	cout << vall[0].second << " " << vall[0].first << endl;
	cout << vall[1].second << " " << vall[1].first << endl;
}

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

using namespace std;
typedef pair<double, int> P;

void solve()
{
	vector<P> second;
	vector<P> a(8);
	vector<P> b(8);
	vector<P> c(8);
	for(int i = 0; i < 8; ++i)
	{
		cin >> a[i].second >> a[i].first;
	}
	for(int i = 0; i < 8; ++i)
	{
		cin >> b[i].second >> b[i].first;
	}
	for(int i = 0; i < 8; ++i)
	{
		cin >> c[i].second >> c[i].first;
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	second.push_back(a[2]);
	second.push_back(a[3]);
	second.push_back(b[2]);
	second.push_back(b[3]);
	second.push_back(c[2]);
	second.push_back(c[3]);
	sort(second.begin(), second.end());
	cout << a[0].second << " " << a[0].first << endl;
	cout << a[1].second << " " << a[1].first << endl;
	cout << b[0].second << " " << b[0].first << endl;
	cout << b[1].second << " " << b[1].first << endl;
	cout << c[0].second << " " << c[0].first << endl;
	cout << c[1].second << " " << c[1].first << endl;
	cout << second[0].second << " " << second[0].first << endl;
	cout << second[1].second << " " << second[1].first << endl;
}

int main()
{
	solve();
	return(0);
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<double, int>;

int main() {
    vector<P> v(24);
    for(int i=0; i<24; ++i) {
        cin >> v[i].second >> v[i].first;
    }
    sort(v.begin(), v.begin()+8);
    sort(v.begin()+8, v.begin()+16);
    sort(v.begin()+16, v.end());
    cout << fixed << setprecision(2);
    for(int i=0; i<3; ++i) {
        for(int j=0; j<2; ++j) {
            cout << v[i*8+j].second << ' ' << v[i*8+j].first << endl;
        }
    }
    for(int i=0; i<3; ++i) {
        for(int j=0; j<2; ++j) {
            v[i*2+j] = v[i*8+j+2];
        }
    }
    sort(v.begin(), v.begin()+6);
    cout << v[0].second << ' ' << v[0].first << endl;
    cout << v[1].second << ' ' << v[1].first << endl;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

struct Data{
	int n;
	double t;
	bool operator <(const Data &a)const{
		return t<a.t;
	}
	void output(){
		printf("%d %.2lf\n",n,t);
	}
};

int main(){
	Data a[3][8];
	vector<Data> sonota;
	for(int i=0;i<3;i++)for(int j=0;j<8;j++) cin>>a[i][j].n>>a[i][j].t;
	for(int i=0;i<3;i++){
		sort(a[i],a[i]+8);
		a[i][0].output(); a[i][1].output();
		sonota.push_back(a[i][2]); sonota.push_back(a[i][3]);
	}
	sort(sonota.begin(),sonota.end());
	sonota[0].output(); sonota[1].output();
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i = 0; i < (a); i++)
#define reps(i, a, b) for(int i = (a); i < (b); i++)
#define INF 1e9
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
void output(pdi d) {
	printf("%d %.2lf\n", d.second, d.first);
}
int main() {
	vector<vector<pdi>> input = vector<vector<pdi>>(3, vector<pdi>(8, make_pair(0,0)));
	vector<pdi> h;
	rep(i, 3) {
		rep(j, 8) cin >> input[i][j].second >> input[i][j].first;
		sort(input[i].begin(), input[i].end(), greater<pdi>());
		rep(j, 2) {
			output(input[i].back());
			input[i].pop_back();
		}
		rep(j, input[i].size()) h.push_back(input[i][j]);
	}
	sort(h.begin(), h.end(), greater<pdi>());
	rep(i, 2) {
		output(h.back());
		h.pop_back();
	}
	
	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	pair<double, int> a[3][8] = {};
	pair<double, int> b[18] = {};
	rep(i, 0, 3) {
		rep(j, 0, 8) { cin >> a[i][j].second >> a[i][j].first; }
		sort(a[i], a[i] + 8);
		rep(j, 2, 8) { b[i * 6 + (j - 2)] = a[i][j]; }
		rep(j, 0, 2)cout << a[i][j].second << " " << a[i][j].first << endl;
	}
	sort(b, b + 18);
	rep(i, 0, 2)cout << b[i].second << " " << b[i].first << endl;
	return 0;
}