#include<iostream>
#include<fstream>
#include<string>
using namespace std;
struct student
{
    string name;
    int age;
    int score;
};
int main()
{
    student st[4];
    student s;
    student t;
    int i=0;
    for(i=0; i<4; i++)
    {
        cin>>st[i].name>>st[i].age>>st[i].score;
    }
    for(i=0; i<4; i++)
        for(int j=i+1; j<4; j++)
            if(st[i].score<st[j].score)
            {
                t=st[i];
                st[i]=st[j];
                st[j]=t;
            }
    for(i=0; i<4; i++)
        cout<<st[i].name<<" "<<st[i].age<<" "<<st[i].score<<endl;
    return 0;
}

/**************************************************************
	Problem: 2210
	User: admin
	Language: C++
	Result: Accepted
	Time:9 ms
	Memory:2076 kb
****************************************************************/