import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        Map<String,Integer> map=new HashMap<>();
        Map<String, int[]> scoreMap = new HashMap<>();
        for(int i=0;i<n;i++){
            String name=in.next();
            int a=in.nextInt();
            int b=in.nextInt();
            int c=in.nextInt();
            int sum=a+b+c;
            map.put(name,sum);
            scoreMap.put(name, new int[]{a, b, c});
        }
        int max=0;
        String res="";
        for(Map.Entry<String,Integer> map1: map.entrySet()){
            if (map1.getValue() > max) {
                max = map1.getValue();
                res=map1.getKey();
            }
        }
         // 3. 获取该学生的各科成绩,输出最终结果
        int[] scores = scoreMap.get(res);
        System.out.println(res + " " + scores[0] + " " + scores[1] + " " + scores[2]);
    }
}