#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
class Stu
{
public:
string m_Name;
int chinese, math, english;
Stu(string name, int c, int m, int e)
{
this->m_Name = name;
this->chinese = c;
this->math = m;
this->english = e;
}
};
class myGreater
{
public:
bool operator()(Stu& a, Stu& b)
{
int sum1 = a.chinese + a.english + a.math;
int sum2 = b.chinese + b.english + b.math;
return sum1 > sum2;
}
};
int main()
{
int n;
cin >> n;
vector<Stu>v;
for (int i = 0; i < n; i++)
{
string name;
int a, b, c;
cin >> name >> a >> b >> c;
Stu s(name, a, b, c);
v.push_back(s);
}
sort(v.begin(), v.end(), myGreater());
vector<Stu>::iterator it = v.begin();
cout << it->m_Name << " " << it->chinese << " " << it->math << " " << it->english;
}