#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
    vector< pair<double, int> > pl1, pl2, pl3, pl;
    int id;
    double tm;

    for (int i = 0; i < 24; i++) {
        cin >> id >> tm;
        if (i / 8 == 0)
            pl1.push_back(pair<double, int>(tm, id));
        else if (i / 8 == 1)
            pl2.push_back(pair<double, int>(tm, id));
        else if (i / 8 == 2)
            pl3.push_back(pair<double, int>(tm, id));
    }
    sort(pl1.begin(), pl1.end());
    sort(pl2.begin(), pl2.end());
    sort(pl3.begin(), pl3.end());

    for (int i = 2; i < 8; i++) {
        pl.push_back(pl1[i]);
        pl.push_back(pl2[i]);
        pl.push_back(pl3[i]);
    }
    sort(pl.begin(), pl.end());

    for (int i = 0; i < 2; i++)
        cout << pl1[i].second << " " << pl1[i].first << endl;
    for (int i = 0; i < 2; i++)
        cout << pl2[i].second << " " << pl2[i].first << endl;
    for (int i = 0; i < 2; i++)
        cout << pl3[i].second << " " << pl3[i].first << endl;
    for (int i = 0; i < 2; i++)
        cout << pl[i].second << " " << pl[i].first << endl;

    return 0;
}