// 结构体 + 排序
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

const int N = 1010;

struct stu {
    string name;
    int a, b, c, z;
    int p;
} s[N];

bool cmp(stu& x, stu& y) {
    if (x.z != y.z) return x.z < y.z;
    return x.p > y.p;
}

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> s[i].name >> s[i].a >> s[i].b >> s[i].c;
        s[i].p = i;
        s[i].z = s[i].a + s[i].b + s[i].c;
    }
    stu t = *max_element(s + 1, s + n + 1, cmp);
    cout << t.name << " " << t.a << " " << t.b << " " << t.c << endl;

    return 0;
}