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 <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

    for(int i=0; i<24; ++i){
        cin >> data[i].second.first >> data[i].first;
        data[i].second.second = i/8;
    }
    sort(data.begin(), data.end());

    vector<vector<pair<double, int> > > winner(4);
    for(int i=0; i<24; ++i){
        int j = data[i].second.second;
        if(winner[j].size() < 2)
            winner[j].push_back(make_pair(data[i].first, data[i].second.first));
        else if(winner[3].size() < 2)
            winner[3].push_back(make_pair(data[i].first, data[i].second.first));
    }

    for(int i=0; i<4; ++i){
        for(int j=0; j<2; ++j){
            printf("%d %.2f\n", winner[i][j].second, winner[i][j].first);
        }
    }

    return 0;
}

C++: #include <stdio.h>
#include <iostream>

using namespace std;

void hantei (double k[], double t, int kk[], int tt) {
	if (k[1] > t) {
		k[1] = t;
		kk[1] = tt;
	}
	if (k[0] > k[1]) {
		k[1] = k[0];
		kk[1] = kk[0];
		k[0] = t;
		kk[0] = tt;
	}
}

int main() {
	double a[4] = {100.0, 100.0, 100.0, 100.0};
	double b[4] = {100.0, 100.0, 100.0, 100.0};
	double c[4] = {100.0, 100.0, 100.0, 100.0};
	double k[2] = {100.0, 100.0};
	int aa[4];
	int bb[4];
	int cc[4];
	int kk[2];
	double d;
	int dd;
	for (int i = 0; i < 8; i++) {
		cin >> dd >> d;
		if (a[3] > d) {
			a[3] = d;
			aa[3] = dd;
		} 
		for (int j = 2; j >= 0; j--) {
			if (a[j] > a[j+1]) {
				a[j+1] = a[j];
				aa[j+1] = aa[j];
				a[j] = d;
				aa[j] = dd;
			}
		}
	}
	for (int i = 0; i < 8; i++) {
		cin >> dd >> d;
		if (b[3] > d) {
			b[3] = d;
			bb[3] = dd;
		}
		for (int j = 2; j >= 0; j--) {
			if (b[j] > b[j+1]) {
				b[j+1] = b[j];
				bb[j+1] = bb[j];
				b[j] = d;
				bb[j] = dd;
			}
		}
	}
	for (int i = 0; i < 8; i++) {
		cin >> dd >> d;
		if (c[3] > d) {
			c[3] = d;
			cc[3] = dd;
		}
		for (int j = 2; j >= 0; j--) {
			if (c[j] > c[j+1]) {
				c[j+1] = c[j];
				cc[j+1] = cc[j];
				c[j] = d;
				cc[j] = dd;
			}
		}
	}

	hantei(k,a[2],kk,aa[2]);
	hantei(k,a[3],kk,aa[3]);
	hantei(k,b[2],kk,bb[2]);
	hantei(k,b[3],kk,bb[3]);
	hantei(k,c[2],kk,cc[2]);
	hantei(k,c[3],kk,cc[3]);
	
	printf("%d %.2f\n%d %.2f\n%d %.2f\n%d %.2f\n%d %.2f\n%d %.2f\n%d %.2f\n%d %.2f\n", aa[0], a[0], aa[1], a[1], bb[0], b[0], bb[1], b[1], cc[0], c[0], cc[1], c[1], kk[0], k[0], kk[1], k[1]);
	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=8;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;
}

C++: #include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int h,i,j;
  int n[24];
  double v[24];
  for(i=0;i<3;i++)
    for(j=0;j<8;j++)
      cin>>n[8*i+j]>>v[8*i+j];
  for(i=0;i<3;i++){
    do{
      h=0;
      for(j=1;j<8;j++){
	if(v[8*i+j-1]>v[8*i+j]){
	  swap(v[8*i+j-1],v[8*i+j]);
	  swap(n[8*i+j-1],n[8*i+j]);
	  h=1;
	}
      }
    }while(h);
  }
  for(i=0;i<3;i++){
    printf("%d %.2lf\n",n[8*i],v[8*i]);
    printf("%d %.2lf\n",n[8*i+1],v[8*i+1]);
    v[8*i]=0.0;
    v[8*i+1]=0.0;
  }
  do{
    h=0;
    for(j=1;j<24;j++){
      if(v[j-1]>v[j]){
	swap(v[j-1],v[j]);
	swap(n[j-1],n[j]);
	h=1;
      }
    }
  }while(h);
  printf("%d %.2lf\n",n[6],v[6]);
  printf("%d %.2lf\n",n[7],v[7]);
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)

typedef unsigned long long ull;

int main(){
	const int n = 3,m = 8;
	vector<pair<double,int> > v;
	FOR(i,n){
		pair<double,int> x[m];
		FOR(i,m) cin>>x[i].second >> x[i].first;
		sort(x,x+m);
		FOR(i,2) printf("%d %.2lf\n",x[i].second,x[i].first);
		v.insert(v.end(),x+2,x+m);
	}

	sort(v.begin(),v.end());
	FOR(i,2) printf("%d %.2lf\n",v[i].second,v[i].first);

	return 0;
}

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

pair<double,int> s[8],all[18],ans[8];


int main(){
	for(int i=0;i<3;i++){
		for(int j=0;j<8;j++){
			cin>>s[j].second>>s[j].first;
		}
		sort(s,s+8);
		for(int j=2;j<8;j++)
			all[i*6+j-2]=s[j];
		for(int j=0;j<2;j++)
			ans[i*2+j]=s[j];
	}
	sort(all,all+18);
	ans[6]=all[0];
	ans[7]=all[1];
	for(int i=0;i<8;i++){
		printf("%d %.2f\n",ans[i].second,ans[i].first);
	}
	return 0;
}