#include #include #include using namespace std; int main(){ int N; cin >> N; vector> space(10002, vector(10002, -1)); vector> space_max(10002, vector(10002, -1)); short P[N], T[N], R[N]; for(int i = 0; i < N; i++){ cin >> P[i] >> T[i] >> R[i]; space[P[i]][T[i]] = max(space[P[i]][T[i]], R[i]); } for(int i = 10000; i >= 0; i--){ for(int j = 10000; j >= 0; j--){ space_max[i][j] = max({space_max[i + 1][j], space_max[i][j + 1], space[i][j]}); } } for(int i = 0; i < N; i++){ if(space[P[i]][T[i]] == R[i] && max(space_max[P[i] + 1][T[i]], space_max[P[i]][T[i] + 1]) <= R[i]){ cout << i + 1 << endl; } } }