#include <bits/stdc++.h>
using namespace std;

struct Student{
    string name;
    int ch,ma,en,tot;
    Student(string A,int B, int C,int D){
        name = A, ch = B, ma = C, en = D,tot = B + C + D;
    }
    Student() = default;
    bool operator > (const Student &x) const{
        return tot >x.tot;
    }

}a[2000];

string A;
int B,C,D;
int main(){
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> A >> B >> C >> D;
        a[i] = Student(A,B,C,D);
    }
    Student ans = a[1];
    for (int i = 2; i <=n;i++){
        if (a[i] > ans) ans = a[i];
    }
    cout << ans.name << " " << ans.ch << " " << ans.ma << " " << ans.en << endl;
    return 0;

}//跟着视频代码逻辑在敲了了一遍,发现自己结构体还是练太少了 T_T