#include <iostream>
#include <utility>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

typedef pair<string, int> P;

int main()
{
	P run[4][8];
	vector<P> sub;
	
	for (int i = 0; i < 3; i++){
		for (int j = 0; j < 8; j++){
			cin >> run[i][j].second >> run[i][j].first;
		}
		sort(run[i], run[i] + 8);
		
		for (int j = 2; j < 8; j++){
			sub.push_back(run[i][j]);
		}
	}
	sort(sub.begin(), sub.end());
	run[3][0] = sub[0];
	run[3][1] = sub[1];
	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 2; j++){
			cout << run[i][j].second << " " << run[i][j].first << endl;
		}
	}
	
	return 0;
}