import java.util.*;
class Student {
int chinese, math, english, sum;
public Student(int chinese, int math, int english) {
this.chinese = chinese;
this.math = math;
this.english = english;
this.sum = chinese + math + english;
}
}
public class Main {
// 使用Java的PriorityQueue实现成绩排序
static PriorityQueue<Student> s = new PriorityQueue<>(new
Comparator<Student>() {
@Override
public int compare(Student a, Student b) {
// TODO: 实现比较逻辑,按照总分、语文、数学、英语的优先级排序
int ac = a.chinese, am = a.math, ae = a.english;
int bc = b.chinese, bm = b.math, be = b.english;
int allA = ac + am + ae;
int allB = bc + bm + be;
if (allA != allB)return allB - allA;
else {
if (ac != bc)
return bc - ac;
if (am != bm)
return bm - am;
if (ae != be)
return be - ae;
}
return 0;
}
});
public static void insertValue(int chinese, int math, int english) {
Student cao = new Student(chinese, math, english);
s.add(cao);
}
public static void deleteValue() {
// TODO: 实现删除操作
if (!s.isEmpty())s.poll();
}
public static Student getTop() {
// TODO: 返回成绩最好的学生
return s.peek();
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int q = scanner.nextInt();
while (q-- > 0) {
int op = scanner.nextInt();
if (op == 1) {
int chinese = scanner.nextInt();
int math = scanner.nextInt();
int english = scanner.nextInt();
insertValue(chinese, math, english);
}
if (op == 2) {
Student top = getTop();
System.out.println(top.chinese + " " + top.math + " " + top.english);
}
if (op == 3) {
deleteValue();
}
}
scanner.close();
}
}