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
}

Python: first = []
for _ in range(8):
    num, time = map(float, input().split())
    first.append([int(num), time])

second = []
for _ in range(8):
    num, time = map(float, input().split())
    second.append([int(num), time])

third = []
for _ in range(8):
    num, time = map(float, input().split())
    third.append([int(num), time])

loser = []

first_s = sorted(first, key=lambda x: x[1])
print(first_s[0][0], '{0:.2f}'.format(first_s[0][1]))
print(first_s[1][0], '{0:.2f}'.format(first_s[1][1]))
loser.append(first_s[2])
loser.append(first_s[3])

second_s = sorted(second, key=lambda x: x[1])
print(second_s[0][0], '{0:.2f}'.format(second_s[0][1]))
print(second_s[1][0], '{0:.2f}'.format(second_s[1][1]))
loser.append(second_s[2])
loser.append(second_s[3])

third_s = sorted(third, key=lambda x: x[1])
print(third_s[0][0], '{0:.2f}'.format(third_s[0][1]))
print(third_s[1][0], '{0:.2f}'.format(third_s[1][1]))
loser.append(third_s[2])
loser.append(third_s[3])

loser_s = sorted(loser, key=lambda x: x[1])
print(loser_s[0][0], '{0:.2f}'.format(loser_s[0][1]))
print(loser_s[1][0], '{0:.2f}'.format(loser_s[1][1]))

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0138

"""
import sys
from sys import stdin
from operator import itemgetter
input = stdin.readline

def solve(data):
    data.sort(key=itemgetter(1))
    top2 = data[:2]
    others = data[2:]
    return top2, others         #  ??????2?????¨????????\??????id??¨?????????????????????


def main(args):
    others_results = []
    for _ in range(3):
        round_results = []
        for _ in range(8):
            id, time = input().split()
            round_results.append([int(id), float(time)])
        top2, others = solve(round_results)
        others_results.extend(others)

        # ????????????2???????????±
        for id, time in top2:
            print('{} {}'.format(id, time))

    # ????????????3?????\?????????????????????2???????????±
    top2, others = solve(others_results)
    for id, time in top2:
        print('{} {}'.format(id, time))


if __name__ == '__main__':
    main(sys.argv[1:])

Python: tformat = lambda num, time: '{} {:.2f}'.format(num, time)
runners = [[] for _ in range(3)]
thirds = []
for i in range(3):
    for _ in range(8):
        num, time = input().split()
        runners[i].append((float(time), int(num)))
    runners[i].sort()
    thirds += runners[i][2:]
thirds.sort()
for run in runners:
    for time, num in run[:2]:
        print(tformat(num, time))
for time, num in thirds[:2]:
    print(tformat(num, time))

Python: import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


class Info:
    def __init__(self,arg_id,arg_score):
        self.id = arg_id
        self.score = arg_score
        self.float_score = float(self.score)

    def __lt__(self,another):
        return self.float_score < another.float_score


rest = []

for loop in range(3):

    work = []

    for row in range(8):
        tmp_id,score = input().split()
        work.append(Info(int(tmp_id),score))

    work.sort()
    print("%d %s"%(work[0].id,work[0].score))
    print("%d %s"%(work[1].id,work[1].score))

    for row in range(2,len(work)):
        rest.append(work[row])

rest.sort()
print("%d %s"%(rest[0].id,rest[0].score))
print("%d %s"%(rest[1].id,rest[1].score))

Python: A_lis = []
for i in range(3):
    S_lis = []
    for j in range(8):
        p,t = map(float,input().split())
        S_lis.append([int(p),t])
    S_lis = sorted(S_lis, key=lambda x: x[1])
    print(S_lis[0][0],S_lis[0][1])
    S_lis.remove(S_lis[0])
    print(S_lis[0][0],S_lis[0][1])
    S_lis.remove(S_lis[0])
    A_lis += S_lis
A_lis = sorted(A_lis, key=lambda x: x[1])
print(A_lis[0][0],A_lis[0][1])
print(A_lis[1][0],A_lis[1][1])

Python: # Aizu Problem 00138: Track and Field Competition
#
import sys, math, os, copy

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


top3 = []
for run in range(3):
    field = []
    for runner in range(8):
        s = input().split()
        field.append([runner, int(s[0]), float(s[1])])
    field = sorted(field, key=lambda x: (x[2], x[0]))
    print("%d %.2f" % (field[0][1], field[0][2]))
    print("%d %.2f" % (field[1][1], field[1][2]))
    top3.append(field[2])

top3 = sorted(top3, key=lambda x: (x[2], x[0]))
print("%d %.2f" % (top3[0][1], top3[0][2]))
print("%d %.2f" % (top3[1][1], top3[1][2]))

Python: ans=[0]*8
group=[]
re=[]
for i in range(8):
    p,t=map(float,input().split())
    group.append([t,int(p)])
group.sort()
ans[0]=group.pop(0)
ans[1]=group.pop(0)
re.append(group.pop(0))
re.append(group.pop(0))
for i in range(8):
    p,t=map(float,input().split())
    group.append([t,int(p)])
group.sort()
ans[2]=group.pop(0)
ans[3]=group.pop(0)
re.append(group.pop(0))
re.append(group.pop(0))
for i in range(8):
    p,t=map(float,input().split())
    group.append([t,int(p)])
group.sort()
ans[4]=group.pop(0)
ans[5]=group.pop(0)
re.append(group.pop(0))
re.append(group.pop(0))
re.sort()
ans[6]=re.pop(0)
ans[7]=re.pop(0)
for i in ans:
    print(i[1],i[0])

Python: race1 = {}
for i in range(8):
    p, t = input().split()
    race1[int(p)] = float(t)
race2 = {}
for i in range(8):
    p, t = input().split()
    race2[int(p)] = float(t)
race3 = {}
for i in range(8):
    p, t = input().split()
    race3[int(p)] = float(t)
for p,t in sorted(race1.items(), key = lambda x: x[1])[:2]:
    print(p,race1.pop(p))
for p,t in sorted(race2.items(), key = lambda x: x[1])[:2]:
    print(p,race2.pop(p))
for p,t in sorted(race3.items(), key = lambda x: x[1])[:2]:
    print(p,race3.pop(p))
race1.update(race2)
race1.update(race3)
for p,t in sorted(race1.items(), key = lambda x: x[1])[:2]:
    print(p,race1.pop(p))