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

typedef pair<double, int> PAIR;

int main(){
	int c;
	double v;
	priority_queue<PAIR> queu;
	for(int i = 0; i < 3; i++){
		priority_queue<PAIR> que;
		for(int j = 0; j < 8; j++){
			scanf("%d %lf", &c, &v);
			que.push(PAIR(-v, c));
		}
		c = que.top().second;
		v = que.top().first;
		printf("%d %.2lf\n", c, -v);
		que.pop();
		c = que.top().second;
		v = que.top().first;
		printf("%d %.2lf\n", c, -v);
		que.pop();
		for(int j = 0; j < 18; j++){
			queu.push(PAIR(que.top().first, que.top().second));
			que.pop();
		}
	}
	c = queu.top().second;
	v = queu.top().first;
	printf("%d %.2lf\n", c, -v);
	queu.pop();
	c = queu.top().second;
	v = queu.top().first;
	printf("%d %.2lf\n", c, -v);
	queu.pop();
	return 0;
}

C++: #include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef pair<double,int> P;

int main(){
  P a[3][8];
  vector <P> b,ans;
  for(int i=0;i<3;i++){
    for(int j=0;j<8;j++) cin>>a[i][j].s>>a[i][j].f;
    sort(a[i],a[i]+8);
    ans.push_back(a[i][0]);
    ans.push_back(a[i][1]);
    for(int j=2;j<8;j++) b.push_back(a[i][j]);
  }
  sort(b.begin(),b.end());
  ans.push_back(b[0]);
  ans.push_back(b[1]);
  for(int i=0;i<8;i++) cout <<ans[i].s<<" "<<ans[i].f<<endl;
  


  return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<map>
#include<iomanip>
using namespace std;

int main()
{
	map<double, double> x;
	map<double, double> y;
	map<double, double> z;
	map<double, double> s;
	auto k = x.begin();
	for (int a = 0; a < 8; a++) {
		double b, c;
		cin >> b >> c;
		x.insert(pair<double,double>(c,b));
	}
	k = x.begin();
	k++; k++;
	s.insert(pair<double, double>(k->first, k->second));
	k++;
	s.insert(pair<double, double>(k->first, k->second));
	for (int a = 0; a < 8; a++) {
		double b, c;
		cin >> b >> c;
		y.insert(pair<double, double>(c,b));
	}
	k = y.begin();
	k++; k++;
	s.insert(pair<double, double>(k->first, k->second));
	k++;
	s.insert(pair<double, double>(k->first, k->second));
	for (int a = 0; a < 8; a++) {
		double b, c;
		cin >> b >> c;
		z.insert(pair<double,double>(c,b));
	}
	k =z.begin();
	k++; k++;
	s.insert(pair<double, double>(k->first, k->second));
	k++;
	s.insert(pair<double, double>(k->first, k->second));

	k = x.begin();
	cout <<  k->second<< fixed << setprecision(2) << " "<<k->first<< endl;
	k++;
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
	k = y.begin();
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
	k++;
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
		k = z.begin();
		cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
	k++;
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
	k = s.begin();
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
	k++;
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
}

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

#define MAX 24
using namespace std;
typedef pair<int,double> Rec;

bool LessRec(const Rec &a, const Rec &b){
	return a.second < b.second;
}

ostream &operator<<(ostream &os, const Rec t){
	printf("%d %.2f", t.first, t.second);
	//os << t.first << ' ' << setprecision(2) << t.second;
	return os;
}

int main()
{
	vector< pair<int, double> > vPlayers;

	for(int i=0;i<MAX;++i)
	{
		int t;
		double time;
		cin >> t >> time;
		vPlayers.push_back( make_pair(t,time) );
	}

	sort( vPlayers.begin(), vPlayers.begin() + 8, LessRec );
	cout << vPlayers[0] << '\n' << vPlayers[1] << '\n';
	sort( vPlayers.begin() + 8, vPlayers.begin() + 16, LessRec );
	cout << vPlayers[8] << '\n' << vPlayers[9] << '\n';
	sort( vPlayers.begin() + 16, vPlayers.end(), LessRec );
	cout << vPlayers[16] << '\n' << vPlayers[17] << '\n';

	vPlayers.erase( vPlayers.begin() );
	vPlayers.erase( vPlayers.begin() );
	vPlayers.erase( vPlayers.begin()+6 );
	vPlayers.erase( vPlayers.begin()+6 );
	vPlayers.erase( vPlayers.begin()+12 );
	vPlayers.erase( vPlayers.begin()+12 );

	sort( vPlayers.begin(), vPlayers.end(), LessRec );

	cout << vPlayers[0] << '\n' << vPlayers[1] << '\n';	

	return 0;
}

C++: 
import java.util.Arrays;
import java.util.Scanner;
 class Player implements Comparable<Player>{
	int num;
	double time;
	public Player(int num,double time){
		this.num=num;
		this.time=time;
	}
	@Override
	public String toString(){
		return num+" "+time;
	}
	@Override
	public int compareTo(Player p){
		return new Double(time).compareTo(p.time);
	}	
}

public class Main{
	static void doit(){
		Scanner scan = new Scanner(System.in);
		Player player[]=new Player[24];
		Player[] f_player=new Player[8];
		Player[] memo=new Player[6];
		for(int i=0;i<24;i++){
			player[i]=new Player(scan.nextInt(),scan.nextDouble());
		}
		//System.out.println(Arrays.toString(player));
		Arrays.sort(player,0,7);
		Arrays.sort(player,8,15);
		Arrays.sort(player,16,23);
		int k=0;
		for(int i=0;i<24;i+=8){
			f_player[k]=player[i];
			f_player[k+1]=player[i+1];
			k+=2;
		}
		int cnt=0;
		for(int i=2;i<=18;i+=8){
			memo[cnt]=player[i];
			memo[cnt+1]=player[i+1];
			cnt+=2;
		}
		Arrays.sort(memo);
		f_player[6]=memo[0];
		f_player[7]=memo[1];
		//System.out.println(Arrays.toString(memo));
		//System.out.println(Arrays.toString(f_player));
		for(int i=0;i<8;i++){
			System.out.printf("%d %.2f\n", f_player[i].num,f_player[i].time);
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().doit();
	}

}