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 <vector>
#include <map>
#include <algorithm>
using namespace std;

int main(){
	//double t[1000] = {};
	map<int,double> t;
	vector<double> ans;
	vector<double> p;

	for(int i=0 ; i<3 ; ++i ){
		vector<double> vc;
		for(int j=0 ; j<8 ; ++j ){
			int No;
			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<iostream>
#include<cstdio>
#include<utility>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef pair<double,int> p;

int main(){
	p ath[3][8];
	rep(i,3)rep(j,8)cin>>ath[i][j].second>>ath[i][j].first;
	rep(i,3)sort(ath[i],ath[i]+8);
	rep(i,3)rep(j,2)printf("%d %.2f\n",ath[i][j].second,ath[i][j].first);
	p hoge[18];
	int cnt=0;
	rep(i,3)loop(j,2,8){hoge[cnt]=ath[i][j];cnt++;}
	sort(hoge,hoge+18);
	rep(i,2)printf("%d %.2f\n",hoge[i].second,hoge[i].first);
	return 0;
}

C++: #include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

typedef struct _player{
	int num;
	double time;
}player;

bool lesstime(const player&l,const player&r){return l.time<r.time;}

vector<player> nokori;

void pr(player&p){
	printf("%d %.2f\n",p.num,p.time);
}

int main(){
	for(int i=0;i<3;i++){
		vector<player> rane;
		for(int j=0;j<8;j++){
			int n;
			double t;
			cin>>n>>t;
			player tp={n,t};
			rane.push_back(tp);
		}
		sort(rane.begin(),rane.end(),lesstime);
		pr(rane[0]);
		pr(rane[1]);
		for(int j=2;j<8;j++){
			nokori.push_back(rane[j]);
		}
	}
	
	sort(nokori.begin(),nokori.end(),lesstime);
	pr(nokori[0]);
	pr(nokori[1]);
}

C++: #include <bits/stdc++.h>
using namespace std;

using P = pair<double, int>;

int main()
{
	cout << fixed << setprecision(2);
	vector<int> p(8);
	vector<double> t(8);
	set<P> s;
	for (int j = 0; j < 3; j++) {
		int n1, n2;
		double t1 = 1000, t2 = 1000;
		for (int i = 0; i < 8; i++) {
			cin >> p[i] >> t[i];
			s.insert((P(t[i], p[i])));
			if (t1 > t[i]) {
				t2 = t1;
				n2 = n1;
				t1 = t[i];
				n1 = i;
			}
			else if (t2 > t[i]) {
				t2 = t[i];
				n2 = i;
			}
		}
		cout << p[n1] << ' ' << t[n1] << endl;
		cout << p[n2] << ' ' << t[n2] << endl;
		s.erase(P(t[n1], p[n1]));
		s.erase(P(t[n2], p[n2]));
	}
	cout << s.begin()->second << ' ' << s.begin()->first << endl;
	s.erase(s.begin());
	cout << s.begin()->second << ' ' << s.begin()->first << endl;
	return 0;
}

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

#define f first
#define s second

int main(){
  typedef pair<double,int> pi;
  vector <pi> vec;
  vector <vector<pi> > data(3,vector<pi>(8));
  double tmp2;
  int tmp;
  for(int i=0;i<3;i++){
    for(int j=0;j<8;j++){
      cin >> data[i][j].s >> data[i][j].f;
    }
  }
  for(int i=0;i<3;i++) sort(data[i].begin(),data[i].end());
  for(int i=0;i<3;i++){
    for(int j=0;j<2;j++) printf("%d %.2f\n",data[i][j].s,data[i][j].f);
  }
  for(int i=0;i<3;i++){
    for(int j=2;j<4;j++) vec.push_back(pi(data[i][j].f,data[i][j].s));
  }
  sort(vec.begin(),vec.end());
  for(int i=0;i<2;i++){
    printf("%d %.2f\n",vec[i].s,vec[i].f);
  }
}

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(M.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;
}