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 <map>
#include <cstdlib>

using namespace std;

int comp(const void* a,const void* b) {

  pair<int,double>* t1=(pair<int,double>*) a;
  pair<int,double>* t2=(pair<int,double>*) b;

  if(t1->second > t2->second) return 1;

  else if(t1->second < t2->second) return -1;

  else return 0;

}

int main() {

  int id;
  double time;

  pair<int,double> rec1[10],rec2[10],rec3[10],reclose[20];

  while(cin >> id >> time) {

    rec1[0].first=id;
    rec1[0].second=time;

    for(int i=1;i<8;i++) {

      cin >> id >> time;

      rec1[i].first=id;
      rec1[i].second=time;
      
    }

    for(int i=0;i<8;i++) {

      cin >> id >> time;

      rec2[i].first=id;
      rec2[i].second=time;

    }

    for(int i=0;i<8;i++) {

      cin >> id >> time;

      rec3[i].first=id;
      rec3[i].second=time;

    }

    qsort(rec1,8,sizeof(rec1[0]),comp);

    qsort(rec2,8,sizeof(rec2[0]),comp);

    qsort(rec3,8,sizeof(rec3[0]),comp);

    //for(int i=0;i<8;i++) cout << rec1[i].first << " " << rec1[i].second << endl;
    
    for(int i=0;i<18;i++) {

      if(i<6) {

	reclose[i].first=rec1[(i%6)+2].first;
	reclose[i].second=rec1[(i%6)+2].second;

      }

      else if(i<12) {

	reclose[i].first=rec2[(i%6)+2].first;
	reclose[i].second=rec2[(i%6)+2].second;

      }

      else {

	reclose[i].first=rec3[(i%6)+2].first;
	reclose[i].second=rec3[(i%6)+2].second;

      }

    }

    //for(int i=0;i<18;i++) cout << reclose[i].first << " " << reclose[i].second << endl;
    
    qsort(reclose,18,sizeof(reclose[0]),comp);
    
    for(int i=0;i<2;i++) cout << rec1[i].first << " " << rec1[i].second << endl;

    for(int i=0;i<2;i++) cout << rec2[i].first << " " << rec2[i].second << endl;

    for(int i=0;i<2;i++) cout << rec3[i].first << " " << rec3[i].second << endl;

    for(int i=0;i<2;i++) cout << reclose[i].first << " " << reclose[i].second << endl;
    
 }

  return 0;

}

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

int main(){
	map<long long int,double> t;
	vector<long double> ans;
	vector<long double> p;

	for(int i=0 ; i<3 ; ++i ){
		vector<long double> vc;
		for(int j=0 ; j<8 ; ++j ){
			long long int No;
			long double time;
			scanf("%d %lf", &No , &time );
			t[No] = time;
			vc.push_back(time);
			p.push_back(time);
		}
		sort( vc.begin() , vc.end() );
		ans.push_back( vc[0] );
		ans.push_back( vc[1] );
	}
	vector<double> foo;
	for(int i=0 ; i<(int)p.size() ; ++i){
		bool flag = true;
		for(int j=0 ; j<(int)ans.size() ; ++j )
			if( p[i] == ans[j] )
				flag = false;
		
		if( flag )
			foo.push_back( p[i] );
	}
	sort( foo.begin() , foo.end() );
	ans.push_back( foo[0] );
	ans.push_back( foo[1] );
	
	for(int i=0 ; i<(int)ans.size() ; ++i ){
		for(int j=0 ; j<25 ; ++j ){
			if( t[j] == ans[i] )
				printf("%d %.2f\n", j , ans[i] );
		}
	}
}

C++: #include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
struct P {
double first;
int second;
};
class great {
public:
    bool operator()(const P& a, const P& b) {
        return a.first<b.first;
    }
};
P team1[8], team2[8], team3[8];
P amari[18];
int main() {
    for (int i=0; i<8; i++)
        scanf("%d%lf",&team1[i].second,&team1[i].first);
    for (int i=0; i<8; i++)
        scanf("%d%lf",&team2[i].second,&team2[i].first);
    for (int i=0; i<8; i++)
        scanf("%d%lf",&team3[i].second,&team3[i].first);
    sort(team1, team1+8, great());
    sort(team2, team2+8, great());
    sort(team3, team3+8, great());
    for (int i=2; i<8; i++) amari[i-2]=team1[i];
    for (int i=2; i<8; i++) amari[i+4]=team2[i];
    for (int i=2; i<8; i++) amari[i+10]=team3[i];
    sort(amari, amari+18, great());
    printf("%d %.2lf\n%d %.2lf\n",team1[0].second,team1[0].first,
                                  team1[1].second,team1[1].first);
    printf("%d %.2lf\n%d %.2lf\n",team2[0].second,team2[0].first,
                                  team2[1].second,team2[1].first);
    printf("%d %.2lf\n%d %.2lf\n",team3[0].second,team3[0].first,
                                  team3[1].second,team3[1].first);
    printf("%d %.2lf\n%d %.2lf\n",amari[0].second,amari[0].first,
                                  amari[1].second,amari[1].first);
}

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(M1.s/10>0)cout<<M1.nu<<" "<<M1.m<<"."<<M1.s<<endl;
else if(M1.s/10==0)cout<<M1.nu<<" "<<M1.m<<"."<<"0"<<M1.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<iostream>
#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;
}