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<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	int num;
	double time;
	int res[8];
	double r[8];
	int i;
	for(i=0;i<8;i++)r[i]=1000000;
	for(i=0;i<8;i++){
		cin>>num>>time;
		if(time<r[0]){
			if(r[1]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[1];
				res[6]=res[1];
			}else if(r[1]<r[7]){
				r[7]=r[1];
				res[7]=res[1];
			}
			r[1]=r[0];
			res[1]=res[0];
			r[0]=time;
			res[0]=num;
		}else if(time<r[1]){
			if(r[1]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[1];
				res[6]=res[1];
			}else if(r[1]<r[7]){
				r[7]=r[1];
				res[7]=res[1];
			}
			r[1]=time;
			res[1]=num;
		}
	}
	for(i=0;i<8;i++){
		cin>>num>>time;
		if(time<r[2]){
			if(r[3]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[3];
				res[6]=res[3];
			}else if(r[3]<r[7]){
				r[7]=r[3];
				res[7]=res[3];
			}
			r[3]=r[2];
			res[3]=res[2];
			r[2]=time;
			res[2]=num;
		}else if(time<r[3]){
			if(r[3]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[3];
				res[6]=res[3];
			}else if(r[3]<r[7]){
				r[7]=r[3];
				res[7]=res[3];
			}
			r[3]=time;
			res[3]=num;
		}
	}
	for(i=0;i<8;i++){
		cin>>num>>time;
		if(time<r[4]){
			if(r[5]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[5];
				res[6]=res[5];
			}else if(r[5]<r[7]){
				r[7]=r[5];
				res[7]=res[5];
			}
			r[5]=r[4];
			res[5]=res[4];
			r[4]=time;
			res[4]=num;
		}else if(time<r[5]){
			if(r[5]<r[6]){
				r[7]=r[6];
				res[7]=res[6];
				r[6]=r[5];
				res[6]=res[5];
			}else if(r[5]<r[7]){
				r[7]=r[5];
				res[7]=res[5];
			}
			r[5]=time;
			res[5]=num;
		}
	}
	for(i=0;i<8;i++){
		printf("%d %2.2f\n",res[i],r[i]);
	}
	return 0;
}

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

struct ply{int cl;int nu;int m;int s;int A;};

int main()
{

ply NUM[4][25],M1,M2,M3,T;
for(int ii=0;ii<3;ii++)
{
	
	for(int i=0;i<8;i++)
	{
		NUM[ii][i].cl=ii;
		scanf("%d %d.%d",&NUM[ii][i].nu,&NUM[ii][i].m,&NUM[ii][i].s);
		NUM[ii][i].A=100*NUM[ii][i].m+NUM[ii][i].s;
	}
	for(int i=0;i<8;i++)
		for(int j=7;j>i;j--)
			if(NUM[ii][i].A>NUM[ii][j].A)swap(NUM[ii][i],NUM[ii][j]);

}
M1=NUM[0][2];M2=NUM[1][2];M3=NUM[2][2];
if(M1.A<M2.A)swap(M1,M2);
if(M1.A<M3.A)swap(M1,M3);
if(M2.A<M3.A)swap(M2,M3);
for(int i=0;i<2;i++){
		for(int j=0;j<1;j++){
			if(NUM[i][j].s/10>0)cout<<NUM[i][j].nu<<" "<<NUM[i][j].m<<"."<<NUM[i][j].s<<endl;
			else if(NUM[i][j].s/10==0)cout<<NUM[i][j].nu<<" "<<NUM[i][j].m<<"."<<"0"<<NUM[i][j].s<<endl;
		}
}
if(M3.s/10>0)cout<<M3.nu<<" "<<M3.m<<"."<<M3.s<<endl;
else if(M3.s/10==0)cout<<M3.nu<<" "<<M3.m<<"."<<"0"<<M3.s<<endl;

if(M2.s/10>0)cout<<M2.nu<<" "<<M2.m<<"."<<M2.s<<endl;
else if(M2.s/10==0)cout<<M2.nu<<" "<<M2.m<<"."<<"0"<<M2.s<<endl;

return 0;
}

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

typedef struct
{
  int n;
  double t;
} Runner;

class LessTime
{
public:
  bool operator() (const Runner& lhs, const Runner& rhs) const
  {
    return lhs.t < rhs.t;
  }
};

int main()
{
  vector<vector<Runner> > p(3, vector<Runner>(8));
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 8; ++j)
      scanf("%d %lf", &p[i][j].n, &p[i][j].t);
    sort(p[i].begin(), p[i].end(), LessTime());

    for (int j = 0; j < 2; ++j) {
      printf("%d %.2lf\n", p[i][0].n, p[i][0].t);
      p[i].erase(p[i].begin());
    }
  }

  vector<Runner> pp;
  for (int i = 0; i < 3; ++i)
    copy(p[i].begin(), p[i].end(), back_inserter(pp));
  sort(pp.begin(), pp.end(), LessTime());

  for (int i = 0; i < 2; ++i) {
    printf("%d %.2lf\n", pp[0].n, pp[0].t);
    pp.erase(pp.begin());
  }
  return 0;
}

C++: #include <stdio.h>
typedef struct{
  int p;
  double t;
}run;
int main(void){
  run g[3][8],tmp,min1,min2;
  int i,j,k;
  for(i=0;i<3;i++){
    for(j=0;j<8;j++)
      scanf("%d %lf",&g[i][j].p,&g[i][j].t);
  }
  for(i=0;i<3;i++){
    for(j=0;j<7;j++){
      for(k=7;k>j;k--){
	if(g[i][k-1].t>g[i][k].t){
	  tmp=g[i][k-1];
	  g[i][k-1]=g[i][k];
	  g[i][k]=tmp;
	}
      }
    }
  }
  for(i=0;i<3;i++){
    for(j=0;j<2;j++)
      printf("%d %.2f\n",g[i][j].p,g[i][j].t);
  }
  min1.t=100;
  for(i=0;i<3;i++){
    for(j=7;j>2;j--){
      if(g[i][j].t<min1.t){
	min2=min1;
	min1=g[i][j];
      }
    }
  }
  printf("%d %.2f\n",min1.p,min1.t);
  printf("%d %.2f\n",min2.p,min2.t);
  return 0;
}