#include using namespace std; struct PTR{ int P, T, R, idx; PTR(int p=0, int t=0, int r=0, int i=0):P(p), T(t), R(r), idx(i){} bool operator<(const PTR &rhs){ if (P > rhs.P){ return true; }else if (P < rhs.P){ return false; }else if (T > rhs.T){ return true; }else if (T < rhs.T){ return false; }else if (R > rhs.R){ return true; }else{ return false; } } }; ostream &operator<<(ostream &stream, const PTR &ptr){ stream << '(' << ptr.P << ", " << ptr.T << ", " << ptr.R << ", " << ptr.idx << ')'; return stream; }; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector ptrs(N); for (int i = 0; i < N; ++i){ cin >> ptrs[i].P >> ptrs[i].T >> ptrs[i].R; ptrs[i].idx = i + 1; } sort(ptrs.begin(), ptrs.end()); map trs; trs[-1] = 1e9; trs[20000] = -1; vector ans; for (auto &ptr : ptrs){ auto right = trs.lower_bound(ptr.T); if (right->second >= ptr.R) continue; ans.push_back(ptr.idx); if (right->first == ptr.T and right->second < ptr.R){ right->second = ptr.R; }else{ right = trs.insert(right, make_pair(ptr.T, ptr.R)); } auto left = right; while (left->second <= ptr.R) --left; ++left; trs.erase(left, right); } sort(ans.begin(), ans.end()); for (auto & a : ans) cout << a << '\n'; return 0; }