#include <iostream>
#include <algorithm>
using namespace std;
struct Ship {
int id, power, armor;
};
// 三重关键字比较逻辑
bool cmp(Ship a, Ship b) {
if (a.power != b.power) return a.power > b.power;
if (a.armor != b.armor) return a.armor > b.armor;
return a.id < b.id;
}
int main() {
int n;
cin >> n;
Ship ships[1005];
for(int i = 1; i <= n; i++) {
cin >> ships[i].id >> ships[i].power >> ships[i].armor;
}