#include<bits/stdc++.h>
using namespace std;
typedef pair<double,int>pii;
int main(){
    vector<pii>rize;
    vector<vector<pii>>gotiusa(3,vector<pii>());
    for(int i=1; i<=24;i++){
        pii tiya; cin>>tiya.second>>tiya.first;
        if(i<=8){gotiusa[0].push_back(pii(tiya));}
        else if(i<=16){gotiusa[1].push_back(tiya);}
        else gotiusa[2].push_back(tiya);
    }
    for(int i=0; i<3;i++)sort(gotiusa[i].begin(),gotiusa[i].end());
    for (int i=0;i<3;i++) {
        for(int j=0; j<2;j++)cout<<gotiusa[i][j].second<<" "<<gotiusa[i][j].first<<endl;
        for(int j=2; j<gotiusa[i].size();j++)rize.push_back(gotiusa[i][j]);
    }
    sort(rize.begin(),rize.end());
    for(int i=0;i<2;i++)cout<<rize[i].second<<" "<<rize[i].first<<endl;
}