#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class Data{
public:
	int first;
	double second;
	string third;
};

int main(){
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	deque<Data> P1(8),P2(8),P3(8),P;
	REP(i,8){
		P1[i].first=in(),P1[i].third=in<string>();
	}
	REP(i,8){
		P2[i].first=in(),P2[i].third=in<string>();
	}
	REP(i,8){
		P3[i].first=in(),P3[i].third=in<string>();
	}

	auto comp = [](Data& l,Data& r){return l.third<r.third;};
	sort(ALL(P1),comp);
	sort(ALL(P2),comp);
	sort(ALL(P3),comp);
	
	REP(i,2){
		out(P1[0].first,P1[0].third);
		P1.pop_front();
	}
	REP(i,2){
		out(P2[0].first,P2[0].third);
		P2.pop_front();
	}
	REP(i,2){
		out(P3[0].first,P3[0].third);
		P3.pop_front();
	}
	copy(ALL(P1),back_inserter(P));
	copy(ALL(P2),back_inserter(P));
	copy(ALL(P3),back_inserter(P));
	sort(ALL(P),comp);

	REP(i,2){
		out(P[0].first,P[0].third);
		P.pop_front();
	}
	return 0;
}

