#include <iostream>
#include <map>

using namespace std;

int main(){
	int number;
	float times;
	map<float, int> race1, race2, race3,top;

	for(int i = 0; i<24; i++){
		cin >> number >> times;
		if(i<8){
			race1.insert(make_pair(times, number));
		} 
		else if(i<16){
			race2.insert(make_pair(times, number));
		} else {
			race3.insert(make_pair(times, number));
		}
	}

	int cnt = 0;
	for(auto it = race1.begin(); cnt < 4; it++){
			if(cnt<2) cout << it->second << " " << it->first << endl;
			else top.insert(make_pair(it->first, it->second));
			cnt++;
		}
	for(auto it = race2.begin(); cnt < 8; it++){
			if(cnt<6) cout << it->second << " " << it->first << endl;
			else top.insert(make_pair(it->first, it->second));
			cnt++;
		}
	for(auto it = race3.begin(); cnt < 12; it++){
			if(cnt<10) cout << it->second << " " << it->first << endl;
			else top.insert(make_pair(it->first, it->second));
			cnt++;
		}
	for(auto it = top.begin(); cnt < 14; it++){
			cout << it->second << " " << it->first << endl;
			cnt++;
		}


}