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<vector>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
typedef pair<double,int> P;

int main(void){
	priority_queue<P, vector<P>, greater<P> > atime;
	queue<P> ktime;
	for(int i=0;i<3;i++){
		priority_queue<P, vector<P>, greater<P> > time;
		for(int j=0;j<8;j++){
			int a;
			double b;
			scanf("%d%lf",&a,&b);
			time.push(P(b,a));
		}
		for(int j=0;j<2;j++){
			P p=time.top();time.pop();
			ktime.push(P(p.first,p.second));
		}
		for(int j=0;j<2;j++){
			P p=time.top();time.pop();
			atime.push(P(p.first,p.second));
		}
	}
	for(int j=0;j<6;j++){
		P p=ktime.front();ktime.pop();
		printf("%d %0.2f\n",p.second,p.first);
	}
	for(int j=0;j<2;j++){
		P p=atime.top();atime.pop();
		printf("%d %0.2f\n",p.second,p.first);
	}
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef pair<double,int> P;
int main(){
  P p;
  vector<P> v,v2;
  int i,j,k;
  for(j=0;j<3;j++){
    for(i=0;i<8;i++){
      cin >> p.second >> p.first; 
      v.push_back(p);
    }
    sort(v.begin(),v.end());
    printf("%d %.2f\n",v[0].second,v[0].first);
    printf("%d %.2f\n",v[1].second,v[1].first);
    for(i=2;i<8;i++) v2.push_back(v[i]);
    v.clear();
  }
  sort(v2.begin(),v2.end());
  printf("%d %.2f\n",v2[0].second,v2[0].first);
  printf("%d %.2f\n",v2[1].second,v2[1].first);
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

typedef struct{
	int no;
	double time;
}person;


int main(){
	person p[24];
	double a[8], b[8], c[8], loser[18], f[8];
	
	for(int i=0; i<8; ++i) {
		scanf(" %d %lf", &p[i].no, &p[i].time);
		a[i]=p[i].time;
	}
	for(int i=0; i<8; ++i) {
		scanf(" %d %lf", &p[i+8].no, &p[i+8].time);
		b[i]=p[i+8].time;
	}
	for(int i=0; i<8; ++i) {
		scanf(" %d %lf", &p[i+16].no, &p[i+16].time);
		c[i]=p[i+16].time;
	}
		
	sort(a, a+8);
	f[0]=a[0]; f[1]=a[1];
	sort(b, b+8);
	f[2]=b[0]; f[3]=b[1];
	sort(c, c+8);
	f[4]=c[0]; f[5]=c[1];
	
	//for(int i=0; i<6; ++i) printf("f[%d]=%lf\n", i, f[i]);
	
	for(int i=2; i<8; ++i) loser[i-2]=a[i];
	for(int i=2; i<8; ++i) loser[i-2+6]=b[i];
	for(int i=2; i<8; ++i) loser[i-2+12]=c[i];
	
	sort(loser, loser+16);
	f[6]=loser[0]; f[7]=loser[1];
	
	for(int i=0; i<8; ++i){
		for(int j=0; j<24; ++j){
			if(f[i]==p[j].time){
				printf("%d %.2lf\n", p[j].no, p[j].time);
			}
		}
	}
	
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
struct runner{
    int num;
    double time;
    bool operator<(const runner &a)const{
        return time<a.time;
    }
};
int main(){
    runner lis[24],calis[18];
    int calissz=0;
    for(int i=0;i<24;i++)cin>>lis[i].num>>lis[i].time;
    for(int i=0;i<3;i++)sort(lis+8*i,lis+8*i+8);
    for(int i=0;i<3;i++){
        for(int j=0;j<8;j++){
            if(j<2)cout<<lis[i*8+j].num<<' '<<lis[i*8+j].time<<endl;
            else{
                calis[calissz]=lis[i*8+j];
                calissz++;
            }
        }
    }
    sort(calis,calis+18);
    for(int i=0;i<2;i++)cout<<calis[i].num<<' '<<calis[i].time<<endl;
    return 0;
}

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

struct Player
{
  int num;
  double time;
};

void PlayerSwap( Player* player1, Player* player2 )
{
  Player tmp;
  tmp = *player1;
  *player1 = *player2;
  *player2 = tmp;
}

void PlayerSort( Player* players, int length)
{
  for (int i=1; i<length; i++)
  {
    for (int j=i; j !=0 && players[j].time < players[j-1].time; j--)
    {
      PlayerSwap(&players[j], &players[j-1]);
    }
  }
}

int main()
{
  const int player_length = 24;
  Player players[player_length];
  Player final_players[8];
  for (int i=0; i<player_length; i++)
  {
    cin >> players[i].num >> players[i].time;
  }

  for (int i=0; i<3; i++)
  {
    Player* plr[8];
    for (int j=0; j<8; j++)
    {
      plr[j] = &players[i*8+j];
    }
    PlayerSort( *plr, 8 );
    for (int j=0; j<2; j++)
    {
      final_players[i*2+j] = players[i*8+j];
      players[i*8+j].time = 1000;
    }
  }

  PlayerSort( players, player_length );
  final_players[6] = players[0];
  final_players[7] = players[1];

  for (int i=0; i<8; i++)
  {
    cout << final_players[i].num << ' ' << final_players[i].time << endl;
  }
}