#include #include #include using namespace std; int main(){ int N; cin >> N; vector> space(10001, vector(10001, 0)); int 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]] = R[i]; } vector> right_down_max(10001, vector(10001)); for(int i = 0; i <= 10000; i++){ right_down_max[i][10000] = space[i][10000]; right_down_max[10000][i] = space[10000][i]; } for(int i = 0; i < 10000; i++){ for(int j = 0; j < 10000; j++){ right_down_max[i][j] = max({right_down_max[i + 1][j], right_down_max[i][j + 1], space[i][j]}); } } for(int i = 0; i < N; i++){ if(right_down_max[P[i]][T[i]] <= R[i]){ cout << i + 1 << endl; } } }