#include <stdio.h>
#include <stdlib.h>
 
typedef struct 
{
    char s[9];
    int c1;//语文成绩
    int c2;//数学成绩
    int c3;//英语成绩
} Student;


int maxIndex(Student std[],int len)
{
    int i = 0;
    // int sumGrade[len];
    // for(i = 0;i < len;i++)
    // {
    //     sumGrade[i] = std[i].c1 + std[i].c2 + std[i].c3;
    // }

    // int maxSumGrade = sumGrade[0];
    // int j = 0;
    // for(j = 0;j < len;j++)
    // {
    //     if(maxSumGrade < sumGrade[j])
    //     {
    //         return j;
    //     }
    // }

    int maxSum = std[0].c1 + std[0].c2 + std[0].c3;
    int maxIdx = 0;
    for(int i = 0;i < len;i++)
    {
        int sum = std[i].c1 + std[i].c2 + std[i].c3;
        if(sum > maxSum)
        {
            maxSum = sum;
            maxIdx = i;
        }
    }
    return maxIdx;
}

int main() {
    int N;
    scanf("%d",&N);

    Student *student = (Student*)malloc(sizeof(Student) * N);
    if(student == NULL)
    {
        //free(student);//因为此时指针为NULL,free对NULL无效,直接返回即可
        return -1;
    }

    int i = 0;
    for(i = 0;i < N;i++)
    {
        scanf("%s",student[i].s);
        scanf("%d",&student[i].c1);
        scanf("%d",&student[i].c2);
        scanf("%d",&student[i].c3);
    }

    int temp = maxIndex(student,N);
    printf("%s %d %d %d",student[temp].s,student[temp].c1,student[temp].c2,student[temp].c3);

    free(student);


    return 0;
}