#include<iostream>
using namespace std;
#include<cctype>
struct students{
char name[10];
int chi;
int math;
int eng;
};
void best(students player[],int n);
int main()
{
int n;
cin>>n;
students player[n];
for(int index=0;index<n;index++)
cin>>player[index].name>>player[index].chi>>player[index].math>>player[index].eng;
for(int index=0;index<n;index++)
best(player,n);
return 0;
}
void best(students player[],int n)
{
int max=0,i;
for(int index=0;index<n;index++)
{
if(player[index].chi+player[index].math+player[index].eng>max)
{max=player[index].chi+player[index].math+player[index].eng;i=index;}
}
cout<<player[i].name<<" "<<player[i].chi<<" "<<player[i].math<<" "<<player[i].eng;
}